登录论坛

查看完整版本 : 比较两个向量MATLAB


poster
2019-12-14, 20:46
我想得到2个向量的错误率吗?

喜欢

# incorrect numbers 6 error rate = ______________________ = ____ # total numbers(size) 15 这是15数字, 9是正确的x是正确的答案(参考), y是带有答案的向量,我想将它们进行比较并得出错误率:

x= [1 ,1,1, 1,1, 1,1,1,1,1, 1,-1,-1,-1,-1] y= [-1,1,1,-1,1,-1,1,1,1,1,-1, 1,-1, 1,-1]

我正在做什么也是Corret吗?好的,我对我更新的公式有误。


回答:

如果要得到错误率,则需要不正确值的数量除以值的总数。您可以使用关系运算符 (http://www.mathworks.com/help/techdoc/ref/relationaloperators.html) ~=和函数MEAN (http://www.mathworks.com/help/techdoc/ref/mean.html)来执行此操作 (http://www.mathworks.com/help/techdoc/ref/relationaloperators.html) :

errorRate = mean(x ~= y);

更多&回答... (https://stackoverflow.com/questions/5380465)