plotscikit-learncurves

scikit-learn - How Plotting learning curves for scores related to only one class


I'm working with a binary classification (2 classes: A and B) and I'm interested in plotting the learning curves but only in relation to one of the classes, say B, which is the rare class. Is that possible to be done with scikit-learn? What I've a plotted so far is the F1, which is an F1 average for the 2 classes but I don't see a way for just plotting the scores for each individually.


Solution

  • An F1 score for a single class isn't really meaningful. Any change to how you are making predictions for the 1s or "positive class" (the rare one probably) obviously changes how frequently you are predicting 0s.

    What might be more useful is to plot the recall on the rare class and how it increases as you fit the model. You could also plot the occurrences of false negatives (cases in which the model predicts a 0 but should have predicted the rare positive class). These would show how predictions on the individual classes become more precise as the model improves.