how to display the class result in knn classification?

1 view (last 30 days)
hello everyone
I would like to display the 4 class of image classification results with KNN but I always got 2 class how a can display the 4 class this is my code :
C=[1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 ];
T=[MA1;MA2;MA3;MA4;MA5;MB1;MB2;MB3;MB4;MB5;MC1;MC2;MC3;MC4;MC5;MD1;MD2;MD3;MD4;MD5];
model=ClassificationKNN.fit(T,C,'NumNeighbors',2);
[~,result1]=predict(model,x);
img1= reshape(result1(:,2),nn,mm);

Answers (0)

Community Treasure Hunt

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

Start Hunting!