I'm doing the multiclass classification using Logistic Regression approach. Basically I know that if I use accuracy_score () function (for example, from sklearn library) it will calculate me the accuracy of distinct value to distinct value like this:
y_pred = [0, 2, 1, 3]
y_true = [0, 1, 2, 3]
accuracy_score(y_true, y_pred)
0.5
But I want to get the accuracy_score_new () function for a vector of top Logistic Regression predictions for each label (from predict_proba) and calculates whether the true label is in this interval like this:
y_pred = [[0,1,3] [2,1,4], [1,2,5] [3,7,9]]
y_true = [0, 1, 2, 3]
accuracy_score_new(y_true, y_pred)
1
The accuracy_score_new in this example will be equal to 1 because the classifier predicts that the label is in the interval. How can this function be done?
Accuracy is just (matching values /total values).
So in your case it will be something like: