KNN分類器を使用していますが、MATLABでknnclassifyが分類を行っていることがわかりました。
コード:
Class = knnclassify(TestVec,TrainVec, TrainLabel);
私が今直面している問題は、knnclassifyがポイントを分類して値を与えるだけですが、この分類の精度を見つけたいと思います。
私はこのようなことを試みました:
Class = knnclassify(TestVec,TrainVec, TrainLabel);
cp = classperf(TestLabel,Class);
cp.CorrectRate
それは私にこのエラーを与えています:
??? Error using ==> classperf at 149
When the class labels of the CP object are numeric, the output
of the classifier must be all non-negative integers or NaN's.
Error in ==> KNN at 3
cp = classperf(TestLabel,Class);
分類器の精度を見つけるためのより良い方法はありますか、または上記のコードを改善するためにどのような修正を行う必要がありますか?