تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
سيكون التعلم الآلي أبسط بكثير إذا كانت كل منحنيات الخسارة تبدو على هذا النحو في المرة الأولى التي تدرّبت فيها على النموذج:
الشكل 20. منحنى خسارة مثالي
من الصعب غالبًا تفسير منحنيات الخسارة. استخدِم
حدسك بشأن منحنيات الخسارة لحلّ التمارين الواردة في هذه الصفحة.
التمرين 1: منحنى الخسارة المذبذب
الشكل 21. منحنى الخسارة المتذبذبة
ما هي الإجراءات الثلاثة التي يمكنك اتّخاذها لمحاولة تحسين منحنى الخسارة
المعروض في الشكل 21؟
تحقَّق من بياناتك مقارنةً بمخطّط بيانات لرصد الأمثلة السيئة، ثمّ
أزِل الأمثلة السيئة من مجموعة التدريب.
نعم، هذه ممارسة جيدة لجميع الطُرز.
خفض معدّل التعلّم
نعم، غالبًا ما يكون تقليل معدّل التعلّم فكرة جيدة عند تصحيح أخطاء
مشكلة في التدريب.
قلِّل مجموعة التدريب إلى عدد صغير من الأمثلة الموثوق بها.
على الرغم من أنّ هذه الطريقة تبدو مصطنعة، إلا أنّها في الواقع
فكرة جيدة. بافتراض أنّ النموذج يتقارب مع مجموعة صغيرة من
الأمثلة الموثوق بها، يمكنك بعد ذلك إضافة المزيد من الأمثلة تدريجيًا،
وربما اكتشاف الأمثلة التي تتسبّب في تذبذُب منحنى الخسارة.
زيادة عدد الأمثلة في مجموعة التدريب
هذه فكرة مغرية، ولكن من غير المرجّح أن تؤدي إلى حلّ
المشكلة.
زيادة معدّل التعلّم
بشكل عام، تجنَّب زيادة معدّل التعلّم عندما يشير منحنى التعلّم
للنموذج إلى حدوث مشكلة.
التمرين 2 منحنى الخسارة مع قفزة حادة
الشكل 22. ارتفاع حاد في الخسارة
أي عبارتَين من العبارات التالية تحدّدان الأسباب المُحتمَلة
للخسارة المتزايدة الموضّحة في الشكل 22؟
تحتوي بيانات الإدخال على قيمة NaN واحدة أو أكثر، على سبيل المثال، قيمة
ناجمة عن قسمة بصفر.
وهذا أكثر شيوعًا ممّا تتوقّع.
تحتوي بيانات الإدخال على عدد كبير من القيم الشاذة.
في بعض الأحيان، قد يحتوي أحد الدفعات على
الكثير من القيم الشاذة بسبب ترتيب الدفعات بشكل غير صحيح.
معدّل التعلّم منخفض جدًا.
قد يؤدي معدّل التعلّم المنخفض جدًا إلى زيادة وقت التدريب، ولكنه ليس هو سبب منحنى الخسارة الغريب.
معدّل التنظيم مرتفع جدًا.
صحيح أنّ التّنظيم العالي جدًا يمكن أن يمنع النموذج من
التقارب، ولكنّه لن يؤدّي إلى منحنى الخسارة الغريب
الموضّح في الشكل 22.
التمرين 3 تباين خسارة الاختبار عن خسارة التدريب
الشكل 23. ارتفاع حاد في حالات فقدان القيمة الصالحة
أي عبارة من العبارات التالية تحدِّد بشكل أفضل سبب اختلاف منحنيات الخسارة في مجموعتَي التدريب
والاختبار؟
يُجري النموذج عملية تعلُّم زائد على مجموعة التدريب.
نعم، من المحتمل أنّه كذلك. إليك بعض الحلول المحتملة:
عليك تبسيط النموذج، ربما من خلال تقليل عدد
السمات.
زيادة معدّل التسوية
تأكَّد من أنّ مجموعة التدريب ومجموعة الاختبار متساويتان إحصائيًا.
معدّل التعلّم مرتفع جدًا.
إذا كان معدّل التعلّم مرتفعًا جدًا، من المرجّح ألا يتصرف منحنى الخسارة لمجموعة التدريب
بالطريقة التي تصرف بها.
التمرين 4 توقُّف منحنى الخسارة
الشكل 24. فقدان عشوائي بعد عدد معيّن من الخطوات
أي عبارة من العبارات التالية هي التفسير الأكثر احتمالًا
لمنحنى الخسارة المفاجئ المعروض في الشكل 24؟
لم يتم ترتيب مجموعة التدريب بشكل جيد.
هذا احتمال وارد. على سبيل المثال، قد تؤدي مجموعة التدريب التي تحتوي على 100
صورة للكلاب متبوعة بـ 100 صورة للقطط إلى تذبذب ضياع
أثناء تدريب النموذج. تأكَّد من ترتيب
الأمثلة بشكل عشوائي بما يكفي.
معدّل التنظيم مرتفع جدًا.
من غير المرجّح أن يكون هذا هو السبب.
تحتوي مجموعة التدريب على عدد كبير جدًا من الميزات.
تاريخ التعديل الأخير: 2025-06-02 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-06-02 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\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)"]]