Main Content

La traducción de esta página está obsoleta. Haga clic aquí para ver la última versión en inglés.

Desarrollo y evaluación de modelos

Selección de características, selección de modelos, optimización de hiperparámetros, validación cruzada, diagnósticos de valores residuales y gráficas

Al desarrollar un modelo de regresión de alta calidad, es importante seleccionar las características (o predictores) correctos, ajustar los hiperparámetros (parámetros del modelo no ajustados a los datos) y evaluar los supuestos del modelo a través de diagnósticos de valores residuales.

Puede ajustar los hiperparámetros mediante iteraciones entre la selección de los valores para los mismos y la realización de una validación cruzada de un modelo con sus propias opciones. Este proceso arroja varios modelos y el mejor de ellos puede ser el que minimice el error de generalización estimado. Por ejemplo, para ajustar un modelo SVM, elija un conjunto de restricciones de cajas y escalas de kernel, realice una validación cruzada de un modelo para cada par de valores y, después, compare las estimaciones de los errores cuadráticos medios con validación cruzada de 10 iteraciones.

Determinadas funciones de regresión no paramétricas de Statistics and Machine Learning Toolbox™ ofrecen además un ajuste automático de los hiperparámetros mediante optimización bayesiana, búsqueda por cuadrículas o búsqueda aleatoria. Sin embargo, bayesopt, que es la función principal para implementar la optimización bayesiana, es lo suficientemente flexible para muchas otras aplicaciones. Para obtener más información, consulte Bayesian Optimization Workflow.

Para seleccionar automáticamente un modelo con hiperparámetros ajustados, utilice fitrauto. La función prueba una selección de tipos de modelos de regresión con diferentes valores en los hiperparámetros y devuelve un modelo final que se prevé que funcione bien. Utilice fitrauto cuando no sepa con seguridad los tipos de modelos de regresión que mejor se adaptan a sus datos.

Para desarrollar y evaluar modelos de regresión de forma interactiva, utilice la app Regression Learner.

Para interpretar un modelo de regresión, puede utilizar lime, shapley y plotPartialDependence.

Apps

Regression LearnerTrain regression models to predict data using supervised machine learning

Funciones

expandir todo

fsrftestUnivariate feature ranking for regression using F-tests
fsrncaFeature selection using neighborhood component analysis for regression
oobPermutedPredictorImportancePredictor importance estimates by permutation of out-of-bag predictor observations for random forest of regression trees
partialDependenceCompute partial dependence
plotPartialDependenceCreate partial dependence plot (PDP) and individual conditional expectation (ICE) plots
predictorImportanceEstimates of predictor importance for regression tree
predictorImportanceEstimates of predictor importance for regression ensemble
relieffRank importance of predictors using ReliefF or RReliefF algorithm
sequentialfsSequential feature selection using custom criterion
stepwiselmPerform stepwise regression
stepwiseglmCreate generalized linear regression model by stepwise regression
fitrautoAutomatically select regression model with optimized hyperparameters
bayesoptSelect optimal machine learning hyperparameters using Bayesian optimization
hyperparametersVariable descriptions for optimizing a fit function
optimizableVariableVariable description for bayesopt or other optimizers
crossvalEstimate loss using cross-validation
cvpartitionPartition data for cross-validation
repartitionRepartition data for cross-validation
testTest indices for cross-validation
trainingTraining indices for cross-validation

Explicaciones independientes del modelo local interpretable (LIME, por sus siglas en inglés)

limeLocal interpretable model-agnostic explanations (LIME)
fitFit simple model of local interpretable model-agnostic explanations (LIME)
plotPlot results of local interpretable model-agnostic explanations (LIME)

Valores de Shapley

shapleyShapley values
fitCompute Shapley values for query point
plotPlot Shapley values

Dependencia parcial

partialDependenceCompute partial dependence
plotPartialDependenceCreate partial dependence plot (PDP) and individual conditional expectation (ICE) plots
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 regression model
coefTestLinear hypothesis test on generalized linear regression model coefficients
devianceTestAnalysis of deviance for generalized linear regression model
plotDiagnosticsPlot observation 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

Objetos

expandir todo

FeatureSelectionNCARegressionFeature selection for regression using neighborhood component analysis (NCA)
BayesianOptimizationBayesian optimization results

Temas

Flujo de trabajo de la app Regression Learner

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

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.

Selección de características

Introduction to Feature Selection

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

Sequential Feature Selection

This topic introduces to sequential feature selection and provides an example that selects features sequentially using a custom criterion and the sequentialfs function.

Neighborhood Component Analysis (NCA) Feature Selection

Neighborhood component analysis (NCA) is a non-parametric method for selecting features with the goal of maximizing prediction accuracy of regression and classification algorithms.

Robust Feature Selection Using NCA for Regression

Perform feature selection that is robust to outliers using a custom robust loss function in NCA.

Select Predictors for Random Forests

Select split-predictors for random forests using interaction test algorithm.

Selección de modelos automatizados

Automated Regression Model Selection with Bayesian and ASHA Optimization

Use fitrauto to automatically try a selection of regression model types with different hyperparameter values, given training predictor and response data.

Optimización de hiperparámetros

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.

Interpretación de modelos

Interpret Machine Learning Models

Explain model predictions using lime, shapley, and plotPartialDependence.

Shapley Values for Machine Learning Model

Compute Shapley values for a machine learning model using two algorithms: kernelSHAP and the extension to kernelSHAP.

Validación cruzada

Implement Cross-Validation Using Parallel Computing

Speed up cross-validation using parallel computing.

Diagnósticos de modelos lineales

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.

Diagnósticos de modelos lineales generalizados

Generalized Linear Models

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

Diagnósticos de modelos no lineales

Nonlinear Regression

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