matlab - How to find an accuracy of a classifier -
matlab - How to find an accuracy of a classifier -
i using knn classifier , found knnclassify classification me in matlab.
code:
class = knnclassify(testvec,trainvec, trainlabel);
the problem face now, knnclassify classifies points , gives them value find accuracy of classification.
i tried this:
class = knnclassify(testvec,trainvec, trainlabel); cp = classperf(testlabel,class); cp.correctrate
it giving me error:
??? error using ==> classperf @ 149 when class labels of cp object numeric, output of classifier must non-negative integers or nan's. error in ==> knn @ 3 cp = classperf(testlabel,class);
is there improve method find accuracy of classifier or corrections should improve code above?
the values of labels should 0 or 1.
the code type :
cp = classperf(trainlabel); class = knnclassify(testvec,trainvec, trainlabel); cp = classperf(testlabel,class); cp.correctrate
matlab knn
Comments
Post a Comment