【问题标题】:area under precision-recall curve in R or matlabR或matlab中精确召回曲线下的面积
【发布时间】:2012-09-03 22:16:33
【问题描述】:

我有一个二元目标列表的预测分数。使用 R 或 matlab 计算精确召回曲线下面积的最佳方法是什么?

我对此进行了一些搜索,但没有找到任何相关函数/库来完成此任务。这似乎很奇怪,因为这应该是人们做的相当普遍的事情。不知道我是否错过了什么。任何帮助将不胜感激。

【问题讨论】:

    标签: matlab classification


    【解决方案1】:

    下面是matlab实现

    function auc = scoreAUC(category,posterior)
    % auc = scoreAUC(category,posterior)
    %
    % Calculates the area under the ROC for a given set
    % of posterior predictions and labels. Currently limited to two classes.
    %
    % posterior: n1 matrix of posterior probabilities for class 1
    % category: n1 matrix of categories {0,1}
    % auc: Area under the curve
    %
    % Author: Benjamin Hamner
    % Date Modified: October 14, 2010
    %
    % Algorithm found in
    % A Simple Generalisation of the Area Under the ROC
    % Curve for Multiple Class Classification Problems
    % David Hand and Robert Till
    % http://www.springerlink.com/content/nn141j42838n7u21/fulltext.pdf
    
    r = tiedrank(posterior);
    auc = (sum(r(category==1)) - sum(category==1) * (sum(category==1)+1)/2) / ...
    ( sum(category<1) * sum(category==1));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-21
      • 2018-09-12
      • 2017-09-21
      • 2020-04-18
      • 2020-07-01
      • 2021-09-13
      • 2013-03-09
      • 2016-01-22
      相关资源
      最近更新 更多