【问题标题】:Calculating Precision, Recall, Accuracy using SVM使用 SVM 计算精度、召回率和准确率
【发布时间】:2015-12-05 10:43:24
【问题描述】:

我在 matlab 中训练了 SVM,然后我将模型转移到 OpenCV 以检测汽车的后部。这是代码。

pos_mat = matfile('posfeat.mat');               % positive samples
neg_mat = matfile('negfeat.mat');               % negative samples

posRow  = pos_mat.bigmat;                        % get positve samples
negRow  = neg_mat.bigmatneg;                     % get negative samples

group = ones(135,1);                             % get labels
group(70:135) = -1;

t = 70;
for i =1:1:66
    posRow(t,:) = (negRow(i,:));
    t = t+1;
end
xdata = posRow;


SVMModel = fitcsvm(xdata,group);

beta = (SVMModel.Beta)';

这是输出。

现在我想计算 SVM 分类器的 Precision、Recall 和 Accuracy。这个post 非常有用,但它只提供与精度、召回率、准确性相关的概念。有人可以帮我计算 SVM 分类器的精度、召回率、准确率吗?你可以找到 posfeat 和 negfeat here

【问题讨论】:

    标签: matlab svm


    【解决方案1】:

    根据

    https://www.csie.ntu.edu.tw/~cjlin/libsvm/

    此工具中包含的评估功能有:

    precision
    Precision = true_positive / (true_positive + false_positive)
    recall
    Recall = true_positive / (true_positive + false_negative)
    fscore
    F-score = 2 * Precision * Recall / (Precision + Recall)
    bac
    BAC (Balanced ACcuracy) = (Sensitivity + Specificity) / 2,
    where Sensitivity = true_positive / (true_positive + false_negative)
    and   Specificity = true_negative / (true_negative + false_positive)
    auc
    AUC (Area Under Curve) is the area under the ROC curve.
    

    注意:此工具仅适用于带有标签 {1,-1} 的二进制类 C-SVM。不支持多类、回归和概率估计。 注意:当使用准确度作为评估标准时,交叉验证准确度可能与标准 LIBSVM 不同。原因是 LIBSVM 在内部将数据分组在同一个类中,而这个工具没有。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-06-21
      • 2012-11-26
      • 2020-02-25
      • 2019-11-23
      • 2016-06-19
      • 2021-09-01
      • 2014-11-20
      • 1970-01-01
      相关资源
      最近更新 更多