I am working on face verification problem.I am using LibSVM as a classifier. I want to calculate true positive rate and true negative rate.
By using these two performance measures, I want to calculate Equal error rate and also want to draw ROC curve.
I read about perfcurve command in matlab.But what here score means in command.??
If you are using libsvm, there are three possible return values from the svmpredict
function.
[predicted_label, accuracy, decision_values] = svmpredict(testing_label_vector, testing_instance_matrix, model [,'libsvm_options']);
If you don't specify that you want all the return values, by assigning the output to using several variables, you will only get the first variable, predicted_label
.
If you want to produce an ROC curve, you need the classifier scores for each instance in order to calculate the thresholds. The scores are the decision_values
.
You can then use either roc
or plotroc
from the Neural Network Toolkit or perfcurve
from the Machine Learning Toolkit to generate your ROC curve.
For the true positive and false positive rates at each threshold in the form of a cell array, use
[tpr,fpr,thresholds] = roc(ground_truth, decision_values);
For a plot of the ROC curve, use
plotroc(ground_truth, decision_values);
Or
[X,Y] = perfcurve(ground_truth, decision_values, positive_class_name);
plot(X,Y);
See ROC curve for a binary classifier in MATLAB for another perfcurve
example.