要训练 k 最近邻模型，可以使用 Classification Learner App。为了获得更大的灵活性，可以在命令行界面中使用
fitcknn 训练 k 最近邻模型。训练模型后，可将模型和预测变量数据传递给
|Classification Learner||Train models to classify data using supervised machine learning|
|Cross-validated k-nearest neighbor classifier|
|Classification edge for observations not used for training|
|Classification loss for observations not used for training|
|Cross validate function|
|Classification margins for observations not used for training|
|Predict response for observations not used for training|
|Loss of k-nearest neighbor classifier|
|Loss of k-nearest neighbor classifier by resubstitution|
|Compare accuracies of two classification models using new data|
|Edge of k-nearest neighbor classifier|
|Margin of k-nearest neighbor classifier|
|Edge of k-nearest neighbor classifier by resubstitution|
|Margin of k-nearest neighbor classifier by resubstitution|
Create and compare nearest neighbor classifiers, and export trained models to make predictions for new data.
This example shows how to visualize the decision surface for different classification algorithms.
Understand the steps for supervised learning and the characteristics of nonparametric classification and regression functions.
Categorize data points based on their distance to points in a training data set, using a variety of distance metrics.
Speaker Identification Using Pitch and MFCC (Audio Toolbox)