1. KNN 分类
load fisheriris
X = meas;
Y = species; % 3 分类问题
% 通过训练集进行训练
Mdl = fitcknn(X, Y, 'NumNeighbors', 4);
% 对 mean of dataset 进行预测
flwr = mean(X); % an average flower
flwrClass = predict(Mdl,flwr)
load fisheriris
X = meas;
Y = species; % 3 分类问题
% 通过训练集进行训练
Mdl = fitcknn(X, Y, 'NumNeighbors', 4);
% 对 mean of dataset 进行预测
flwr = mean(X); % an average flower
flwrClass = predict(Mdl,flwr)
转载于:https://www.cnblogs.com/mtcnn/p/9421400.html