37. How to Check If Your ML Model Is Good
37.1 Accuracy in Plain English
Why. “My model is 99% accurate” can still be useless. You need plain-English metrics.
What. Accuracy = share of rows where prediction equals the true label. Great when classes are balanced and mistakes cost the same. Weak when 99% of rows are “not fraud.”
How.
Compute accuracy by hand once
- List true labels and predictions for 10 rows.
- Count matches / 10.
- Ask: is the majority class 90%+? Then accuracy alone may lie.
from sklearn.metrics import accuracy_score
y_true = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1]
y_pred = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] # always predict 0
print("accuracy:", accuracy_score(y_true, y_pred))
print("Looks high, but both fraud cases were missed.")
Ravindra Bagale's Tip
Accuracy pehle vichaara: class balance kay aahe? Nahi tar precision/recall bagha.