MATLAB Answers

youb mr
0

how i can use confusion_matrix for result of image classification using knn?

Asked by youb mr
on 17 Nov 2019 at 18:29
Latest activity Answered by Ridwan Alam on 20 Nov 2019 at 0:33
Hello everyone.
I'm trying to classify an images containing two classes using a Knn classifer.
and would like to evaluate the performance using its confusion matrix. But how can I use it with the KNN classifier?
This is my code of KNN classifer
model=ClassificationKNN.fit(X,Y,'NumNeighbors',9);
[~,result1]=predict(model,x);
how i can use confusion_matrix in this situation

  0 Comments

Sign in to comment.

1 Answer

Answer by Ridwan Alam on 20 Nov 2019 at 0:33

yhat = predict(model,x);
C = confusionmat(y,yhat)

  0 Comments

Sign in to comment.