Classification Model Evaluation

Confusion Matrix

Evaluation Metrics

; print((TP + TN) / (TP + TN + FP + FN))
or
print(metrics.accuracy_score(y_test, y_pred_class))
Cat Example Answer
0.820627802690583
82% Accuracy
print(TP / (TP + FP))
or
print(metrics.precision_score(y_test, y_pred_class))
Cat Example Answer
0.7777777777777778
print(TP / (TP + FN))
or
print(metrics.recall_score(y_test, y_pred_class))
Cat Example Answer
0.7411764705882353
print(TN / (TN + FP))Cat Example Answer
0.8695652173913043
print(FP / (TN + FP))Cat Example Answer
0.13043478260869565
Above is some helpful code utilizing scikit-learn to help get a good understand of your Classification Model. Note: We are trying to (1, or Cats) in the above example

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store