Ravindra BagaleCourses & study guides English Track your progress

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

Data Science

37.2 Precision आणि Recall

का गरजेचे आहे. Fraud आणि churn साठी दोन शब्द आणखी हवेत: precision आणि recall.

हे काय आहे. Positive class साठी (उदा. fraud=1): precision = आपण flag केलेल्या rows पैकी खरेच positive किती? recall = सर्व खऱ्या positives पैकी आपण किती पकडले?

कसे करायचे.

India ops भाषेत लक्षात ठेवा

  1. Precision: “आपण alert उठवला तेव्हा बरोबर होतो का?”
  2. Recall: “खऱ्या fraud cases पैकी किती पकडले?”
  3. High precision, low recall → कमी alerts, जास्त misses.
  4. High recall, low precision → जास्त alerts, जास्त false alarms.
from sklearn.metrics import precision_score, recall_score
y_true = [1, 1, 1, 0, 0, 0, 0, 0]
y_pred = [1, 1, 0, 1, 0, 0, 0, 0]
print("precision:", precision_score(y_true, y_pred))
print("recall:", recall_score(y_true, y_pred))

तुम्हाला काय दिसायला हवे. Precision 2/3 ≈ 0.67 (तीन पैकी दोन बरोबर alerts). Recall 2/3 ≈ 0.67 (तीन खऱ्या positives पैकी दोन पकडले).