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, ingeniería de características, selección de modelos, optimización de hiperparámetros, validación cruzada, evaluación de la capacidad predictiva y pruebas de comparación de la precisión de las clasificaciones

Al desarrollar un modelo de clasificación predictiva de alta calidad, es importante seleccionar las características (o predictores) correctos y ajustar los hiperparámetros (parámetros del modelo que no se han estimado).

La selección de características y el ajuste de los hiperparámetros pueden arrojar varios modelos. Puede comparar las tasas de errores de clasificación de k iteraciones, las curvas ROC, por sus siglas en inglés) o las matrices de confusión entre los modelos. También puede realizar una prueba estadística para detectar si un modelo de clasificación supera significativamente a otro.

Para extraer nuevas características antes de entrenar un modelo de clasificación, utilice gencfeatures.

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

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

Para ajustar los hiperparámetros de un modelo concreto, seleccione los valores de los hiperparámetros y realice una validación cruzada del modelo con dichos valores. Por ejemplo, para ajustar un modelo SVM, elija un conjunto de restricciones de cajas y escalas de kernel y, después, realice una validación cruzada de un modelo para cada par de valores. Determinadas funciones de clasificación de Statistics and Machine Learning Toolbox™ ofrecen un ajuste automático de los hiperparámetros mediante optimización bayesiana, búsqueda por cuadrículas o búsqueda aleatoria. Sin embargo, la función principal utilizada para implementar la optimización bayesiana, bayesopt, es lo suficientemente flexible para utilizarla en otras aplicaciones. Consulte Bayesian Optimization Workflow.

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

Apps

Classification LearnerTrain models to classify data using supervised machine learning

Funciones

expandir todo

fscchi2Univariate feature ranking for classification using chi-square tests
fscmrmrRank features for classification using minimum redundancy maximum relevance (MRMR) algorithm
fscncaFeature selection using neighborhood component analysis for classification
oobPermutedPredictorImportancePredictor importance estimates by permutation of out-of-bag predictor observations for random forest of classification trees
predictorImportanceEstimates of predictor importance for classification tree
predictorImportanceEstimates of predictor importance for classification ensemble of decision trees
sequentialfsSequential feature selection using custom criterion
relieffRank importance of predictors using ReliefF or RReliefF algorithm
gencfeaturesPerform automated feature engineering for classification
describeDescribe generated features
transformTransform new data using generated features
fitcautoAutomatically select classification 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
confusionchartCreate confusion matrix chart for classification problem
confusionmatCompute confusion matrix for classification problem
perfcurveReceiver operating characteristic (ROC) curve or other performance curve for classifier output
testcholdoutCompare predictive accuracies of two classification models
testckfoldCompare accuracies of two classification models by repeated cross-validation

Objetos

expandir todo

FeatureSelectionNCAClassificationFeature selection for classification using neighborhood component analysis (NCA)
FeatureTransformerGenerated feature transformations
BayesianOptimizationBayesian optimization results

Temas

App Classification Learner

Train Classification Models in Classification Learner App

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

Assess Classifier Performance in Classification Learner

Compare model accuracy scores, visualize results by plotting class predictions, and check performance per class in the Confusion Matrix.

Feature Selection and Feature Transformation Using Classification Learner App

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

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.

Tune Regularization Parameter to Detect Features Using NCA for Classification

This example shows how to tune the regularization parameter in fscnca using cross-validation.

Regularize Discriminant Analysis Classifier

Make a more robust and simpler model by removing predictors without compromising the predictive power of the model.

Select Features for Classifying High-Dimensional Data

This example shows how to select features for classifying high-dimensional data.

Ingeniería de características

Automated Feature Engineering for Classification

Use gencfeatures to engineer new features before training a classification model. Before making predictions on new data, apply the same feature transformations to the new data set.

Selección de modelos automatizados

Automated Classifier Selection with Bayesian and ASHA Optimization

Use fitcauto to automatically try a selection of classification 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 Cross-Validated Classifier Using bayesopt

Minimize cross-validation loss using Bayesian Optimization.

Optimize Classifier Fit Using Bayesian Optimization

Minimize cross-validation loss using the OptimizeParameters name-value argument in a fitting function.

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.

Evaluación de la capacidad de la clasificación

Performance Curves

Examine the performance of a classification algorithm on a specific test data set using a receiver operating characteristic curve.