Classify Data Using the Classification Learner App
Classification Learner lets you perform common supervised learning tasks such as interactively exploring your data, selecting features, specifying validation schemes, training models, and assessing results.
You can export classification models to the MATLAB® workspace, or generate MATLAB code to integrate models into applications.
Published: 17 Jun 2020
Whether you're an expert or just getting started with machine learning, you often explore different types of models and repeatedly tune and test those models. The Classification Learner app in the Statistics and Machine Learning toolbox lets you train classification models using supervised machine learning without writing any code.
Classification Learner lets you perform common machine learning tasks, such as importing preprocessed data, exploring your data, quickly training multiple models, assessing model performance, and the iterative steps required to tune model performance, including optimizing hyperparameters, misclassification cost, and feature selection. You can find the Classification Learner in the Apps Gallery or by typing Classification Learner on the MATLAB command line.
Classification Learner lets you import data from matrices or tables. The app can automatically identify your predictors and response variables based on your data type. The next step is to choose the validation scheme used to measure model accuracy.
Once the app has loaded the data, you can choose from several classification algorithms, including Decision Trees, Logistic Regression, Support Vector Machines, and Boosted Trees. If you're not sure which to choose, the pop-up tooltip gives you a brief description of each classifier. Pairwise scatter plots let you explore your data for important predictors, outliers, and visual patterns or trends.
Training a new model is easy. First, in the Model Gallery, choose one of the classifier presets or the Train All option. Next, click on Train.
The Current Model pane displays useful information about your model, such as the classifier type, presets, selected features, and the status of the model. For each trained model, you can see its accuracy on the History panel and inspect its misclassification in the scatter plot, look at the Confusion Matrix, and look at ROC curves available in the Plot section of the toolstrip.
The Confusion Matrix lets you assess how the currently selected classifier performed in each class. Good classifiers have a dominantly diagonal confusion matrix since all the predictor variables matched the actual labels. Off-diagonal numbers indicate confusions between classes.
You can force the classifier to produce specific classifications by placing a higher cost on them during training. To do so, select Misclassification Costs from the toolstrip. Specify Uneven Misclassification Cost. And then retrain the model to see whether it helped reduce the undesired misclassifications.
Based on your assessment of how a model may be improved further, you can use the advanced options to change classifier settings or remove features with low predictive power, either manually or applying one of the many automated feature selection methods that are available at the command line. Instead of manually tuning model parameters, you can choose one of the optimizable models. And the app will try different combinations of hyperparameter values by using an optimization scheme that seeks to minimize the classification error or cost.
The visualization shows how the classification error decreases as different combinations of hyperparameters are evaluated. Outside the app, you can also let MATLAB find the best optimized model in a single step using fitcauto.
After you create models interactively in Classification Learner, you can export your best performing model. Click Export. The model should appear in your MATLAB workspace. And it's predict method allows you to make predictions on new data. You can also generate MATLAB code to train your best model on new data or integrate trained models into computer vision signal processing or data analytics applications.
To deploy unembedded devices, automatically generate C Code for predictions. Or generate a software component from your model for integration with stand-alone or enterprise applications. When working with Classification Learner, help is always just a click away. Simply navigate to the documentation using the Help button on the top right to find all the information you need. For example, the table here shows you guidance on choosing the right classifier, depending on accuracy, speed, and memory constraints.
That concludes a brief introduction to Classification Learner. For more information, click on the links below. Thanks for watching.