本页对应的英文页面已更新,但尚未翻译。 若要查看最新内容,请点击此处访问英文页面。

模型的构建和评估

特征选择、超参数优化、交叉验证、残差诊断、绘图

在构建高质量回归模型时,选择正确的特征(或预测变量)、调整超参数(未与数据拟合的模型参数)以及通过残差诊断评估模型假设非常重要。

您可以先为超参数选择值,然后使用您选择的值对模型进行交叉验证,通过这样的迭代对超参数进行调整。这个过程会生成多个模型,其中估计的泛化误差最小的就是最佳模型。例如,要调整 SVM 模型,可以选择一组框约束和核尺度,使用每对值对模型进行交叉验证,然后比较它们的 10 折交叉验证均方误差估计值。

Statistics and Machine Learning Toolbox™ 中的某些非参数化回归函数还可以通过贝叶斯优化、网格搜索或随机搜索自动调整超参数。用于实现贝叶斯优化的主函数 bayesopt 是足够灵活的,还可以用在其他许多应用中。有关详细信息,请参阅Bayesian Optimization Workflow

App

Regression LearnerTrain regression models to predict data using supervised machine learning

函数

全部展开

sequentialfsSequential feature selection using custom criterion
relieffRank importance of predictors using ReliefF or RReliefF algorithm
plotPartialDependenceCreate partial dependence plot (PDP) and individual conditional expectation (ICE) plots
stepwiselm Fit linear regression model using stepwise regression
stepwiseglmCreate generalized linear regression model by stepwise regression
bayesoptSelect optimal machine learning hyperparameters using Bayesian optimization
hyperparametersVariable descriptions for optimizing a fit function
optimizableVariableVariable description for bayesopt or other optimizers
crossvalLoss estimate using cross-validation
cvpartitionCreate cross-validation partition for data
repartitionRepartition data for cross-validation
testTest indices for cross-validation
trainingTraining indices for cross-validation
coefCIConfidence intervals of coefficient estimates of linear regression model
coefTestLinear hypothesis test on linear regression model coefficients
dwtestDurbin-Watson test with linear regression model object
plotScatter plot or added variable plot of linear regression model
plotAddedAdded variable plot of linear regression model
plotAdjustedResponseAdjusted response plot of linear regression model
plotDiagnosticsPlot observation diagnostics of linear regression model
plotEffectsPlot main effects of predictors in linear regression model
plotInteractionPlot interaction effects of two predictors in linear regression model
plotResidualsPlot residuals of linear regression model
plotSlicePlot of slices through fitted linear regression surface
coefCIConfidence intervals of coefficient estimates of generalized linear model
coefTestLinear hypothesis test on generalized linear regression model coefficients
devianceTestAnalysis of deviance
plotDiagnosticsPlot diagnostics of generalized linear regression model
plotResidualsPlot residuals of generalized linear regression model
plotSlicePlot of slices through fitted generalized linear regression surface
coefCIConfidence intervals of coefficient estimates of nonlinear regression model
coefTestLinear hypothesis test on nonlinear regression model coefficients
plotDiagnosticsPlot diagnostics of nonlinear regression model
plotResidualsPlot residuals of nonlinear regression model
plotSlicePlot of slices through fitted nonlinear regression surface
linhyptestLinear hypothesis test

对象

全部展开

BayesianOptimizationBayesian optimization results
cvpartitionData partitions for cross validation

主题

Regression Learner App 工作流

Train Regression Models in Regression Learner App

Workflow for training, comparing and improving regression models, including automated, manual, and parallel training.

Choose Regression Model Options

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, and ensembles of regression trees.

Feature Selection and Feature Transformation Using Regression Learner App

Identify useful predictors using plots, manually select features to include, and transform features using PCA in Regression Learner.

Assess Model Performance in Regression Learner

Compare model statistics and visualize results.

特征选择

Introduction to Feature Selection

Learn about feature selection algorithms and explore the functions available for feature selection.

超参数优化

Bayesian Optimization Workflow

Perform Bayesian optimization using a fit function or by calling bayesopt directly.

Variables for a Bayesian Optimization

Create variables for Bayesian optimization.

Bayesian Optimization Objective Functions

Create the objective function for Bayesian optimization.

Constraints in Bayesian Optimization

Set different types of constraints for Bayesian optimization.

Optimize a Boosted Regression Ensemble

Minimize cross-validation loss of a regression ensemble.

Bayesian Optimization Plot Functions

Visually monitor a Bayesian optimization.

Bayesian Optimization Output Functions

Monitor a Bayesian optimization.

Bayesian Optimization Algorithm

Understand the underlying algorithms for Bayesian optimization.

Parallel Bayesian Optimization

How Bayesian optimization works in parallel.

交叉验证

Implement Cross-Validation Using Parallel Computing

Speed up cross-validation using parallel computing.

线性模型诊断

Interpret Linear Regression Results

Display and interpret linear regression output statistics.

Linear Regression

Fit a linear regression model and examine the result.

Linear Regression with Interaction Effects

Construct and analyze a linear regression model with interaction effects and interpret the results.

Summary of Output and Diagnostic Statistics

Evaluate a fitted model by using model properties and object functions.

F-statistic and t-statistic

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.

Coefficient of Determination (R-Squared)

Coefficient of determination (R-squared) indicates the proportionate amount of variation in the response variable y explained by the independent variables X in the linear regression model.

Coefficient Standard Errors and Confidence Intervals

Estimated coefficient variances and covariances capture the precision of regression coefficient estimates.

Residuals

Residuals are useful for detecting outlying y values and checking the linear regression assumptions with respect to the error term in the regression model.

Durbin-Watson Test

The Durbin-Watson test assesses whether or not there is autocorrelation among the residuals of time series data.

Cook’s Distance

Cook's distance is useful for identifying outliers in the X values (observations for predictor variables).

Hat Matrix and Leverage

The hat matrix provides a measure of leverage.

Delete-1 Statistics

Delete-1 change in covariance (covratio) identifies the observations that are influential in the regression fit.

广义线性模型诊断

Generalized Linear Models

Generalized linear models use linear methods to describe a potentially nonlinear relationship between predictor terms and a response variable.

非线性模型诊断

Nonlinear Regression

Parametric nonlinear models represent the relationship between a continuous response variable and one or more continuous predictor variables.