To rank classifiers in Matlab, you can use the built-in function perfcurve
. This function computes the receiver operating characteristic (ROC) curve for binary classification problems and allows you to specify different ranking methods for the classifiers.
Here's an example code snippet that demonstrates how to use perfcurve
to rank three different classifiers based on their area under the ROC curve (AUC):
main.m734 chars29 lines
In this example, we generate some example data, fit three different classifiers, and then use perfcurve
to compute their ROC curves and AUCs. The predict
function is used to obtain the scores (i.e., predicted probabilities of class 1) for each classifier on the training data. The perfcurve
function is then used to compute the ROC curves and AUCs, with the true
argument indicating that class 1 is considered the "positive" class. Finally, the ROC curves and AUC values are plotted and printed to the console.
Note that perfcurve
supports several different ranking methods for binary classifiers, including probability estimates, predicted scores, decision values, and others. See the documentation for more details.
gistlibby LogSnag