multiclassification.m

来自「支持向量机 这是我的老师编写的matlab源文件 希望对大家有用」· M 代码 · 共 15 行

M
15
字号
function  Multiclassification
% Multiclassification by KNN
% result = zeros(5,1);
M = size(out_data_test.y,2);
for n = 1:8,
    result = knnclassification(out_data_test.X',out_data_tra.X',out_data_tra.y',n);   
    dif = result-out_data_test.y';
    correct = 0;
    for k = 1:M,
        if dif(k)==0,
            correct = correct+1;
        end
    end
    rate(n) = correct/M;
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?