How to convert knnclassify to fitckkn

조회 수: 1 (최근 30일)
Rosida Octavia Sitorua
Rosida Octavia Sitorua 2021년 4월 30일
x=readtable("datatraining.xlsx");
latih=x;
group=latih(:,3);
latih = [latih(:,1) latih(:,2)];
for i = 1 : 80
y=readtable("datatesting.xlsx");
sampel = y;
test = [sampel(:,1) sampel(:,2)];
%sampel = [2.6136 0.1284 1.3017 -0.8089 0.0441 -0,2084];
hasil=knnclassify(test,latih,group);
end
nama = "hasil KNN.xlsx";
hasil = [sampel(:,1) sampel(:,2) sampel(:,3) hasil];
xlswrite(nama,hasil);

답변 (0개)

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by