Ravindra BagaleCourses & study guides English Track your progress

37. ML Model चांगले आहे का कसे तपासायचे

Data Science

37.1 Accuracy सोप्या भाषेत

का गरजेचे आहे. “माझे model 99% accurate आहे” तरी निरुपयोगी असू शकते. सोप्या भाषेतील metrics हवेत.

हे काय आहे. Accuracy = prediction खऱ्या label शी जुळणाऱ्या rows चा हिस्सा. Classes संतुलित आणि चुकांचा खर्च सारखा असताना उत्तम. 99% rows “not fraud” असताना कमकुवत.

कसे करायचे.

एकदा हाताने accuracy काढा

  1. 10 rows साठी खरे labels आणि predictions लिहा.
  2. Matches / 10 मोजा.
  3. विचारा: majority class 90%+ आहे का? मग फक्त accuracy खोटे बोलू शकते.
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

Before you feel happy about a high accuracy, check the class balance, which means how many rows belong to each class. If one class is much bigger than the others, accuracy can mislead you, so look at precision and recall too.