August 18, 2020
Accuracy, Precision, and Recall
Accuracy is calculated by finding the total number of correctly classified points and dividing by the total number of points.
(True Positives + True Negatives) / (True Positives + True Negatives + False Positives + False Negatives)
True Positive is when the algorithm predicted you would get above a B and you did.
True Negative is when the algorithm predicted you would get below a B, and you did.
False Positive is when the algorithm predicted you would get above a B, and you didn’t.
False Negative is when the algorithm predicted you would get below a B, and you didn’t.
Precision is the number of true positives divided by the number of times the model predicted positive.
True Positives / (True Positives + False Positives)
Recall measures the percentage of relevant items that your classifier found.
True Positives / (True Positives + False Negatives)
F1 Score is the harmonic mean of precision and recall.
2 * (Precision * Recall / Precision + Recall)
Precision and Recall are tied to each other, as one goes up, the other goes down.
Python’s Sci-kit Learn library has functions that will find accuracy, recall, precision, and F1 Score.
accuracy_score
recall_score
precision_score
f1_score
They each take 2 parameters: true labels and predictions