I'm currently struggling plotting a ROC curve for a LinearSVC
model. Since LinearSVC
models can only call decision_function()
to calculate the y_score (as opposed to the usual predict_proba()
), I find it diffcult to compute fpr
and tpr
for each class. When trying
for i in range(n_classes):
fpr[i], tpr[i], _ = roc_curve(y_test[:, i], y_score[:, i])
roc_auc[i] = auc(fpr[i], tpr[i])
I get IndexError: too many indices for array
. Switching to the solution provided in this answer would imply binarising the labels, which I would like to avoid. A normal SVC
model with linear kernel wouldn't allow me to set an l1 penalty for l1-based feature selection, so that's to be avoided as well.
Any ideas on how to solve this?