模型的构建和评估 -凯发k8网页登录
特征选择、特征工程、模型选择、超参数优化、交叉验证、残差诊断和绘图
在构建高质量回归模型时,选择正确的特征(或预测变量)、调整超参数(未与数据拟合的模型参数)以及通过残差诊断评估模型假设非常重要。
您可以先为超参数选择值,然后使用您选择的值对模型进行交叉验证,通过这样的迭代对超参数进行调整。这个过程会生成多个模型,其中估计的泛化误差最小的可能是最佳模型。例如,要调整 svm 模型,可以选择一组框约束和核尺度,使用每对值对模型进行交叉验证,然后比较它们的 10 折交叉验证均方误差估计值。
要在训练回归模型之前对新函数进行工程处理,请使用 。
要以交互方式构建和评估回归模型,请使用。
要自动选择具有调整后的超参数的模型,请使用 。该函数尝试选择具有不同超参数值的回归模型类型,并返回预期表现良好的最终模型。当您不确定哪些回归模型类型最适合您的数据时,请使用 fitrauto
。
statistics and machine learning toolbox™ 中的某些非参数化回归函数通过贝叶斯优化、网格搜索或随机搜索提供自动超参数调整。实现贝叶斯优化的主函数 对于许多其他应用来说也足够灵活。有关详细信息,请参阅bayesian optimization workflow。
要解释回归模型,可以使用 lime
、shapley
和 plotpartialdependence
。
app
使用有监督机器学习训练回归模型来预测数据 |
函数
对象
主题
回归学习器工作流
- train regression models in regression learner app
workflow for training, comparing and improving regression models, including automated, manual, and parallel training.
in regression learner, automatically train a selection of models, or compare and tune options of linear regression models, regression trees, support vector machines, gaussian process regression models, kernel approximation models, ensembles of regression trees, and regression neural networks.
identify useful predictors using plots or feature ranking algorithms, select features to include, and transform features using pca in regression learner.
compare model metrics and visualize results.
特征选择
- introduction to feature selection
learn about feature selection algorithms and explore the functions available for feature selection.
this topic introduces sequential feature selection and provides an example that selects features sequentially using a custom criterion and thesequentialfs
function.
neighborhood component analysis (nca) is a non-parametric method for selecting features with the goal of maximizing prediction accuracy of regression and classification algorithms.
perform feature selection that is robust to outliers using a custom robust loss function in nca.
select split-predictors for random forests using interaction test algorithm.
特征工程
usegenrfeatures
to engineer new features before training a regression model. before making predictions on new data, apply the same feature transformations to the new data set.
自动模型选择
usefitrauto
to automatically try a selection of regression model types with different hyperparameter values, given training predictor and response data.
超参数优化
- bayesian optimization workflow
perform bayesian optimization using a fit function or by callingbayesopt
directly.
create variables for bayesian optimization.
create the objective function for bayesian optimization.
set different types of constraints for bayesian optimization.
minimize cross-validation loss of a regression ensemble.
visually monitor a bayesian optimization.
monitor a bayesian optimization.- bayesian optimization algorithm
understand the underlying algorithms for bayesian optimization.
how bayesian optimization works in parallel.
模型解释
- interpret machine learning models
explain model predictions using thelime
andshapley
objects and theplotpartialdependence
function. - shapley values for machine learning model
compute shapley values for a machine learning model using interventional algorithm or conditional algorithm.
交叉验证
- implement cross-validation using parallel computing
speed up cross-validation using parallel computing.
perform single-step and multiple-step time series forecasting with an ensemble of boosted regression trees.
线性模型诊断
display and interpret linear regression output statistics.
fit a linear regression model and examine the result.
construct and analyze a linear regression model with interaction effects and interpret the results.
evaluate a fitted model by using model properties and object functions.
in linear regression, the f-statistic is the test statistic for the analysis of variance (anova) approach to test the significance of the model or the components in the model. the t-statistic is useful for making inferences about the regression coefficients.
决定系数(r 方)表示线性回归模型中由自变量 x 解释的响应变量 y 的变化比例。
estimated coefficient variances and covariances capture the precision of regression coefficient estimates.
residuals are useful for detecting outlying y values and checking the linear regression assumptions with respect to the error term in the regression model.
the durbin-watson test assesses whether or not there is autocorrelation among the residuals of time series data.
cook's distance is useful for identifying outliers in the x values (observations for predictor variables).
the hat matrix provides a measure of leverage.
delete-1 change in covariance (covratio
) identifies the observations that are influential in the regression fit.
广义线性模型诊断
generalized linear models use linear methods to describe a potentially nonlinear relationship between predictor terms and a response variable.
非线性模型诊断
parametric nonlinear models represent the relationship between a continuous response variable and one or more continuous predictor variables.