In Matlab, there are a variety of classifier training functions, such as "FITCSVM", but also a graphical interface of the classification of Learning Toolbox, which contains SVM, decision tree, KNN and other types of classifiers, the use of very convenient. Then let's talk about how to use it. Start:
Click "Application", find "classification learner" icon in the Panel click to Start, also can enter "Classificationlearner" in the command line, return, also can start. The following figure:
Import Data:
Click "New Session" to import data from your workspace or file. After selecting the data, the import is divided into three steps:
The first step is to determine your data format, where the imported data is a matrix with both sample input and corresponding output. For example, the data I import is the 3*3000 matrix, 3,000 samples, two eigenvalues per sample, and the third row is the corresponding output for each sample. Then I should choose use row as variables, and if the data format is 3000*3, select Use column as variables.
The second step is to specify which row is "response" that is the output response, in this data, the third behavior output, the remainder is "predictor".
The third step, whether the need to verify, generally choose Cross-validation "Cross Validation", Folds said several times, their choice can be.
When you are sure, click "Start Session". Select classifier:
As shown in the following figure, the scatter chart of the original data is displayed, because this data is only two dimensions, so it can be displayed in the two-dimensional coordinates. If your data is more than two dimensions, and the two-dimensional coordinate system does not fully display each dimension, you can choose which two dimensions to display in the X and Y Drop-down strips on the right red circle.
Before training, you can choose the model of training, click the arrow in the red circle, you can see all kinds of training models, choose one, you can choose a class of "All", the class all models will be trained again.
After selecting the model, click on "Train" and start training. Training Results:
The training results are shown on the left, the accuracy of each model after training is displayed, the highest accuracy is labeled, and the following is the model information.
Click "Advance" to set the specific parameters of the model. Click "Confusion Matrix" to see the obfuscation matrix and so on.
Click "Export Model" to export the models to the workspace so that you can use the model to test the new data. It can also be exported as code to facilitate research.