Area with precision response curve in R or Matlab

I have predicted scores for a list of binary goals. What would be the best way to calculate the area for curves with precise recall using R or Matlab?

I did a few searches on this and did not find a suitable function / library to achieve this. This seems strange because it should be a fairly common occurrence that people do. Not sure if I missed something. Any help would be appreciated.

+4
source share
1 answer

Below is the implementation of 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)); 
+1
source

Source: https://habr.com/ru/post/1433507/


All Articles