Metrics for Classifiers
In the previous section, you learned how to train a binary classifier to predict the right output: either 0
or 1
. In Exercise 5.01, Building a Logistic Regression Model, you looked at a few samples to assess the performance of the models that were built. Usually, you would evaluate a model not just on a small subset but on the whole dataset using a performance metric such as accuracy or F1 score.
Accuracy and Null Accuracy
One of the most widely used metrics for classification problems is accuracy. Its formula is quite simple:
The maximum value for accuracy is 1
, which means the model correctly predicts 100% of the cases. Its minimum value is 0
, where the model can't predict any case correctly.
For a binary classifier, the number of correct predictions is the number of observations with a value of 0
or 1
as the correctly predicted value: