Ravindra BagaleCourses & study guides English Track your progress

53. Sentiment Analysis Project in Python

Data Science

53.4 Traps and Guardrails

53.4 Traps आणि guardrails

TF-IDF सर्व text वर fit, stratify skip, 10 rows वर 90% celebrate — real mistakes.

हे का शिकायचं?

Why. Real mistakes: सर्व text वर TF-IDF fit, stratify skip, 10 rows वर 90% celebrate, किंवा baseline check न करता Hinglish noise ship.

हे काय आहे?

What. आधीच्या chapters चे guardrails अजून लागू: आधी split, classes skew असतील तर accuracy पलीकडले metrics, आणि honest demo size.

कसं करायचं?

How.

हे traps टाळा

  1. Vectoriser train+test एकत्र fit करू नका.
  2. Reproducible demos साठी random_state ठेवा.
  3. Tiny sets वर metrics = smoke tests.
  4. Add more labelled lines before business decisions.
# BAD: leaks test vocabulary into the vectoriser
# vec.fit_transform(docs) # then split — do not do this

# GOOD: split first, then fit on X_train only (see 53.2)
print("Remember: split → fit vectoriser on train → transform test")