קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
למידת המכונה הייתה הרבה יותר פשוטה אם כל עקומות ההפסד היו נראות כך בפעם הראשונה שאתם מארגנים את המודל:
איור 20. עקומת אובדן אידיאלית.
לצערנו, לעיתים קרובות קשה לפרש את עקומות ההפסדים. תוכלו להיעזר בתחושות שלכם לגבי עקומות אובדן כדי לפתור את התרגילים בדף הזה.
תרגיל 1: עקומת אובדן תנודתית
איור 21. עקומת אובדן תנודתית.
מהן שלוש הפעולות שאפשר לבצע כדי לשפר את עקומת ההפסדים שמוצגת באיור 21?
בודקים את הנתונים מול סכימה של נתונים כדי לזהות דוגמאות לא טובות, ואז מסירים את הדוגמאות הלא טובות מקבוצת האימון.
כן, מומלץ לעשות זאת בכל המודלים.
להפחית את קצב הלמידה.
כן, בדרך כלל מומלץ להקטין את קצב הלמידה כשמנסים לנפות באגים בבעיה באימון.
צמצום קבוצת האימון למספר קטן של דוגמאות מהימנות.
השיטה הזו עשויה להישמע מלאכותית, אבל היא למעשה רעיון טוב. בהנחה שהמודל מתכנס לקבוצה הקטנה של דוגמאות מהימנות, תוכלו להוסיף בהדרגה דוגמאות נוספות, ואולי לגלות אילו דוגמאות גורמות לתנודות בגרף ההפסד.
להגדיל את מספר הדוגמאות בקבוצת האימון.
זהו רעיון מפתה, אבל סביר מאוד שהוא לא יפתור את הבעיה.
להגדיל את קצב הלמידה.
באופן כללי, מומלץ להימנע מהגדלת קצב הלמידה כשהקו של עקומת הלמידה של המודל מציין בעיה.
תרגול 2. עקומת אובדן עם קפיצה חדה
איור 22. עלייה חדה באובדן.
אילו שתי מההצהרות הבאות מזהות סיבות אפשריות לירידה החדה מוצגת באיור 22?
נתוני הקלט מכילים ערך NaN אחד או יותר – לדוגמה, ערך שנגרם כתוצאה מחלוקה באפס.
התופעה הזו נפוצה יותר ממה שאתם חושבים.
נתוני הקלט מכילים מספר רב של ערכים חריגים.
לפעמים, בגלל ערבוב לא תקין של קבוצות, קבוצה יכולה לכלול הרבה ערכים חריגים.
קצב הלמידה נמוך מדי.
שיעור למידה נמוך מאוד עשוי להאריך את זמן האימון, אבל הוא לא הגורם לעלייה המוזרה בגרף האובדן.
שיעור הרגולריזציה גבוה מדי.
אמנם, רגולריזציה גבוהה מאוד עשויה למנוע מהמודל להגיע לערעור, אבל היא לא תגרום לעלייה המוזרה בגרף האובדן שמוצג באיור 22.
תרגול 3. אובדן הבדיקה שונה מאובדן האימון
איור 23. עלייה חדה באובדן מהאימות.
איזה מהמשפטים הבאים מזהה בצורה הטובה ביותר את הסיבה להבדל הזה בין עקומות האובדן של קבוצות האימון והבדיקה?
המודל מתאים את עצמו יתר על המידה לקבוצת האימון.
כן, סביר להניח שהיא לא אמיתית. פתרונות אפשריים:
לפשט את המודל, אולי על ידי צמצום מספר המאפיינים.
הגדלת שיעור הרגולריזציה.
חשוב לוודא שקבוצת האימון וקבוצת הבדיקה זהות מבחינה סטטיסטית.
קצב הלמידה גבוה מדי.
אם קצב הלמידה היה גבוה מדי, סביר להניח שעקומת האובדן של קבוצת האימון לא הייתה מתנהגת כפי שהיא מתנהגת.
תרגול 4. עקומת ההפסדים נתקעת
איור 24. אובדן אקראי אחרי מספר מסוים של שלבים.
איזה משפט מהמשפטים הבאים הוא ההסבר הסביר ביותר לעלייה הלא סדירה בגרף ההפסדים שמוצג באיור 24?
קבוצת האימון לא מעורבת היטב.
זו אפשרות. לדוגמה, קבוצת אימון שמכילה 100 תמונות של כלבים ואחריה 100 תמונות של חתולים עשויה לגרום לתנודות בערך האובדן במהלך אימון המודל. חשוב לוודא שמדלגים בין הדוגמאות בצורה מספקת.
[null,null,["עדכון אחרון: 2025-06-02 (שעון UTC)."],[[["\u003cp\u003eThis document helps you understand and interpret Machine Learning loss curves through a series of exercises and visual examples.\u003c/p\u003e\n"],["\u003cp\u003eYou will learn how to identify common issues like oscillating loss, exploding loss, overfitting, and erratic behavior in your models.\u003c/p\u003e\n"],["\u003cp\u003eSolutions are provided for each exercise, along with explanations for various loss curve patterns.\u003c/p\u003e\n"],["\u003cp\u003eTechniques to address these issues are discussed, including adjusting learning rate, cleaning training data, and applying regularization.\u003c/p\u003e\n"],["\u003cp\u003eA glossary of key Machine Learning terminology related to loss curves and model training is included for quick reference.\u003c/p\u003e\n"]]],[],null,["# Overfitting: Interpreting loss curves\n\nMachine learning would be much simpler if all your\n[**loss curves**](/machine-learning/glossary#loss_curve)\nlooked like this the first time you trained your model:\n**Figure 20.** An ideal loss curve.\n\nUnfortunately, loss curves are often challenging to interpret. Use your\nintuition about loss curves to solve the exercises on this page.\n\nExercise 1: Oscillating loss curve\n----------------------------------\n\n**Figure 21.** Oscillating loss curve. \nWhat **three** things could you do to try improve the loss curve shown in Figure 21? \nCheck your data against a data schema to detect bad examples, and then remove the bad examples from the training set. \nYes, this is a good practice for all models. \nReduce the learning rate. \nYes, reducing learning rate is often a good idea when debugging a training problem. \nReduce the training set to a tiny number of trustworthy examples. \nAlthough this technique sounds artificial, it is actually a good idea. Assuming that the model converges on the small set of trustworthy examples, you can then gradually add more examples, perhaps discovering which examples cause the loss curve to oscillate. \nIncrease the number of examples in the training set. \nThis is a tempting idea, but it is extremely unlikely to fix the problem. \nIncrease the learning rate. \nIn general, avoid increasing the learning rate when a model's learning curve indicates a problem.\n\nExercise 2. Loss curve with a sharp jump\n----------------------------------------\n\n**Figure 22.** Sharp rise in loss. \nWhich **two** of the following statements identify possible reasons for the exploding loss shown in Figure 22? \nThe input data contains one or more NaNs---for example, a value caused by a division by zero. \nThis is more common than you might expect. \nThe input data contains a burst of outliers. \nSometimes, due to improper shuffling of batches, a batch might contain a lot of outliers. \nThe learning rate is too low. \nA very low learning rate might increase training time, but it is not the cause of the strange loss curve. \nThe regularization rate is too high. \nTrue, a very high regularization could prevent a model from converging; however, it won't cause the strange loss curve shown in Figure 22.\n\nExercise 3. Test loss diverges from training loss\n-------------------------------------------------\n\n**Figure 23.** Sharp rise in validation loss. \nWhich **one** of the following statements best identifies the reason for this difference between the loss curves of the training and test sets? \nThe model is overfitting the training set. \nYes, it probably is. Possible solutions:\n\n- Make the model simpler, possibly by reducing the number of features.\n- Increase the regularization rate.\n- Ensure that the training set and test set are statistically equivalent. \nThe learning rate is too high. \nIf the learning rate were too high, the loss curve for the training set would likely not have behaved as it did.\n\nExercise 4. Loss curve gets stuck\n---------------------------------\n\n**Figure 24.** Chaotic loss after a certain number of steps. \nWhich **one** of the following statements is the most likely explanation for the erratic loss curve shown in Figure 24? \nThe training set is not shuffled well. \nThis is a possibility. For example, a training set that contains 100 images of dogs followed by 100 images of cats may cause loss to oscillate as the model trains. Ensure that you shuffle examples sufficiently. \nThe regularization rate is too high. \nThis is unlikely to be the cause. \nThe training set contains too many features. \nThis is unlikely to be the cause.\n| **Key terms:**\n|\n| - [Batch](/machine-learning/glossary#batch)\n| - [Example](/machine-learning/glossary#example)\n| - [Feature](/machine-learning/glossary#feature)\n| - [Learning rate](/machine-learning/glossary#learning-rate)\n| - [Loss curve](/machine-learning/glossary#loss_curve)\n| - [Outliers](/machine-learning/glossary#outliers)\n| - [Overfitting](/machine-learning/glossary#overfitting)\n| - [Regularization](/machine-learning/glossary#regularization)\n| - [Regularization rate](/machine-learning/glossary#regularization-rate)\n| - [Test set](/machine-learning/glossary#test-set)\n| - [Training set](/machine-learning/glossary#training-set)\n- [Validation set](/machine-learning/glossary#validation_set) \n[Help Center](https://support.google.com/machinelearningeducation)"]]