38. Overfitting and Underfitting in Machine Learning
38.3 Simple Fixes
Why. Once you name the problem, apply simple fixes before fancy theory.
What. Common fixes: more clean rows; fewer / better features; simpler model (shallower tree, fewer forest trees to start); regularisation options later; always keep a true holdout test set.
How.
Fix menu for beginners
- Overfit? Reduce tree depth; add data; drop leaky or noisy columns.
- Underfit? Add useful features; allow a slightly richer model; check you did not delete the signal.
- Always: evaluate on test rows you never trained on.
# Same API, simpler hypothesis
safer_tree = DecisionTreeClassifier(max_depth=3, min_samples_leaf=2, random_state=0)
Ravindra Bagale's Tip
Start with a simple model and a clean train-test split. Add more complex models only later, after the simple one works and you know where it falls short.
Ravindra Bagale's Tip – मराठी
आधी एक साधं model आणि clean train-test split वापरून सुरुवात करा. साधं model नीट चाललं आणि ते कुठे कमी पडतं हे कळलं, त्यानंतरच जास्त complex models वापरा.
Ravindra Bagale's Tip – हिंदी
पहले एक सादा model और clean train-test split से शुरुआत करो. सादा model ठीक से चल जाए और पता चल जाए कि वह कहाँ कम पड़ता है, उसके बाद ही ज़्यादा complex models इस्तेमाल करो.