如何找到分类器的准确率
我正在使用 KNN 分类器,我发现 knnclassify 在 MATLAB 中为我进行分类。
代码:
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);
是否有更好的方法来查找分类器的准确性,或者我应该做哪些更正来改进上面的代码?
I am using the KNN classifier and I found the knnclassify does the classification for me in MATLAB.
code:
Class = knnclassify(TestVec,TrainVec, TrainLabel);
The problem I face now, knnclassify just classifies the points and gives them a value but I would like to find the accuracy of this classification.
I tried something like this:
Class = knnclassify(TestVec,TrainVec, TrainLabel);
cp = classperf(TestLabel,Class);
cp.CorrectRate
It is giving me this error:
??? 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);
Is there a better method to find the accuracy of a classifier or what corrections should I do to improve my code above?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
标签的值应为 0 或 1。
要键入的代码:
the values of the labels should be 0 or 1.
the code to type :