This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Model Building and Assessment

Feature selection, hyperparameter optimization, cross-validation, predictive performance evaluation, classification accuracy comparison tests

When building a high-quality, predictive classification model, it is important to select the right features (or predictors) and tune hyperparameters (model parameters that are not estimated).

To tune hyperparameters, select the hyperparameter values and cross-validate the model using those values. For example, to tune an SVM model, choose a set of box constraints and kernel scales, and then cross-validate a model for each pair of values. Certain Statistics and Machine Learning Toolbox™ classification functions offer automatic hyperparameter tuning through Bayesian optimization, grid search, or random search. However, the main function used to implement Bayesian optimization, bayesopt, is flexible enough for use in other applications. See Bayesian Optimization Workflow.

Feature selection and hyperparameter tuning can yield multiple models. You can compare the k-fold misclassification rates, receiver operating characteristic (ROC) curves, or confusion matrices among the models. Or, conduct a statistical test to detect whether a classification model significantly outperforms another.

To build and assess classification models interactively, use the Classification Learner app.


Classification Learner Train models to classify data using supervised machine learning


sequentialfs Sequential feature selection
relieff Importance of attributes (predictors) using ReliefF algorithm
bayesopt Select optimal machine learning hyperparameters using Bayesian Optimization
hyperparameters Variable descriptions for optimizing a fit function
crossval Loss estimate using cross validation
cvpartition Data partitions for cross validation
repartition Repartition data for cross-validation
test Test indices for cross-validation
training Training indices for cross-validation
confusionmat Confusion matrix
perfcurve Receiver operating characteristic (ROC) curve or other performance curve for classifier output
testcholdout Compare predictive accuracies of two classification models
testckfold Compare accuracies of two classification models by repeated cross validation

Using Objects

BayesianOptimization Bayesian optimization results
optimizableVariable Variable description for bayesopt or other optimizers
cvpartition Data partitions for cross validation


Classification Learner App

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.

Feature Selection

Feature Selection

Learn about feature selection algorithms, such as sequential feature selection.

Hyperparameter Optimization

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 Cross-Validated SVM Classifier Using Bayesian Optimization

Minimize cross-validation loss using bayesopt.

Optimize an SVM Classifier Fit Using Bayesian Optimization

Minimize cross-validation loss using the OptimizeParameters name-value pair 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.


Implement Cross-Validation Using Parallel Computing

Speed up cross-validation using parallel computing.

Classification Performance Evaluation

Performance Curves

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

Was this topic helpful?