Ravindra BagaleCourses & study guides मराठी Track your progress

35. Decision Trees and Random Forests in Python

35.5 Practice, Tip and Close

Why. Close when you can explain tree vs forest and fit both on a tiny table.

How.

Chapter practice

  1. Build a 16-row fictional “refund risk” table for Amazon Now-style orders (distance_km, price_inr, is_fragile).
  2. Fit DecisionTreeClassifier(max_depth=2) and print export_text.
  3. Fit RandomForestClassifier(n_estimators=30) and print feature_importances_.
  4. Write two lines: when you would show the tree to a store manager, and when you would ship the forest.

Thodkyaat sangaycha tar (quick recap)

  • Tree = readable if/else rules
  • Forest = many trees voting — usually stronger
  • Control depth / n_estimators on small laptops
  • Still use train/test split

Samajla ka? Next: Chapter 36 — K-Means Clustering (groups without labels).