Ravindra BagaleCourses & study guides English Track your progress

34. Logistic Regression ने Python मध्ये Classification

Data Science

34.4 Thresholds आणि Class-Balance चुका

का गरजेचे आहे. Labels उलटे, classes छोट्या, किंवा encoding शिवाय raw city text दिल्यास classification notebooks शांतपणे अपयशी ठरतात.

हे काय आहे. लक्ष द्या: majority class predict करून success म्हणणे; rare fraud labels वर stratify skip; 0/1 y वर LinearRegression; city names ला बहुतेक sklearn models आधी encoding लागते हे विसरणे.

कसे करायचे.

त्वरित रक्षक

  1. Split आधी y.value_counts() print करा.
  2. Binary labels साठी शक्य असल्यास stratify=y वापरा.
  3. Features numeric ठेवा (किंवा categories स्पष्ट encode करा).
  4. 95% “not churn” data वर फक्त accuracy साजरी करू नका — Chapter 37.
print(y.value_counts())
# If one class has only 1–2 rows, get more data before trusting metrics.

Ravindra Bagale's Tip

A model that predicts 0 for every row can still show high accuracy, but such a model is useless. This happens when one class is much bigger than the other. Always check the class balance first, so you know what score a simple guess would get.