Skip to main content

Posts

Showing posts from April, 2012

matlab ROC curve

function makeROC() [X,Y,T,AUC] = perfcurve(  trueTestLabel ,  predictedScore , positiveClassLabel ); AUC plot(X,Y) xlabel('1-specificity'); ylabel('sensitivity'); figure plot(T, [Y  1-X   ] ); legend('sensitivity','specificity'); xlabel('Threshold'); ylabel('change in sensitivity and specificity') end function perfBasedOnROCthreshold thr = .41 rocInfo = load('roc20.info'); perfOrigLabel = rocInfo(: , 1); perfPredLabel = rocInfo(: , 2); perfPredScore = rocInfo(: , 3); noTeseCase = size(perfPredScore ,1); newPredictedLabel = zeros( noTeseCase,1); [X,Y,T,AUC] = perfcurve(perfOrigLabel, perfPredScore,1); plot(X,Y) xlabel('1-specificity'); ylabel('sensitivity'); figure plot(T,Y) xlabel('threshold'); ylabel('sensitivity'); figure plot(T,1-X) xlabel('threshold'); ylabel('specificity'); newPos = find(perfPredScore >= thr); newNeg = find(perfPredScor