Overfitting & Underfitting
Fitting की समस्या
जब आप machine learning model train करते हैं, दो चीज़ें गलत हो सकती हैं: यह बहुत कम या बहुत ज़्यादा सीख सकता है। बहुत कम सीखना underfitting है; बहुत ज़्यादा सीखना (noise समेत) overfitting है। लक्ष्य अच्छा संतुलन है — ऐसा model जो असली patterns सीखे और नए data पर अच्छा चले।
Underfitting
Underfitting model data में क्या हो रहा है यह पकड़ने के लिए बहुत सरल होता है।
- संकेत: training और test दोनों data पर बुरी accuracy।
- कारण: model या features बहुत बुनियादी हैं, या training बहुत छोटी थी।
- उपमा: ऐसा student जिसने मुश्किल से पढ़ा — वो practice और असली exam दोनों में बुरा करता है।
Overfitting
Overfitting model training data को बहुत ज़्यादा सीख लेता है, random noise समेत।
- संकेत: बहुत ऊँची training accuracy पर बहुत कम test accuracy।
- कारण: model बहुत complex है, या training data बहुत कम है।
- उपमा: ऐसा student जिसने practice questions रट लिए — उन पर बढ़िया, नए पर खोया हुआ।
कैसे पहचानें
training data बनाम नए (test) data पर performance की तुलना कीजिए:
- दोनों कम → underfitting।
- Training ऊँची, test कम → overfitting।
- दोनों ऊँची और पास → good fit।
Training और test accuracy के बीच यह फ़र्क मुख्य सुराग़ है कि आपको कौन-सी समस्या है।
कैसे ठीक करें
Underfitting ठीक करें:
- ज़्यादा complex model इस्तेमाल कीजिए।
- और उपयोगी features जोड़िए।
- ज़्यादा देर train कीजिए; regularisation कम कीजिए।
Overfitting ठीक करें:
- ज़्यादा training data लीजिए।
- Model सरल कीजिए; regularisation जोड़िए।
- Dropout इस्तेमाल कीजिए (neural nets); training जल्दी रोकिए।
तुलना
| बात | Underfitting | Overfitting |
|---|---|---|
| Model | बहुत सरल | बहुत complex |
| Training accuracy | कम | ऊँची |
| Test accuracy | कम | कम |
| ठीक | Complexity जोड़ें | सरल / ज़्यादा data |
आम भ्रम
- सिर्फ़ training accuracy पर आँकना। हमेशा test/नए data भी जाँचिए, वरना overfitting चूक जाते हैं।
- यह सोचना ज़्यादा complex हमेशा बेहतर। बहुत complex overfitting करता है।
- Underfitting ठीक करने को data जोड़ना। ज़्यादा data overfitting में मदद करता है; underfitting को ज़्यादा model capacity चाहिए।
- Train-test gap अनदेखा करना। वो gap आपका मुख्य diagnostic tool है।
सारांश
- Underfitting: model बहुत सरल, training और test दोनों data पर बुरा।
- Overfitting: model बहुत complex, training पर बढ़िया पर नए data पर बुरा।
- Training बनाम test accuracy की तुलना करके पहचानिए।
- Underfitting को ज़्यादा complexity से; overfitting को ज़्यादा data या सरल models से ठीक कीजिए।
- ऐसा good fit चाहिए जो नए data पर generalise करे।
आगे, ML types समझिए supervised, unsupervised और reinforcement में, या model देखिए spam detection में।
