تقسيم بيانات التدريب والتحقق والاختبار
لماذا تحتاج إلى ثلاث مجموعات لا واحدة
تقسيم بيانات التدريب والتحقق والاختبار درس مجاني في Deep Learning Academy على CoddyKit. هذا هو الدرس 1 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Deep Learning Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Deep Learning Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
One Pile Is Not Enough
If you train and judge a model on the same data, you only learn that it memorized those rows. To trust it, you must split your data into separate roles.
Meet the Training Set
The training set is the data your model actually learns from. Its weights are nudged again and again to fit exactly these examples well.
Meet the Validation Set
The validation set is held back during training and checked along the way. It tells you how the model does on data it has never updated on.
Meet the Test Set
The test set is touched once, at the very end. It gives an honest, final score after every choice has already been made.
Why Validation Is Separate
You tune knobs like learning rate by watching validation results. That quietly leaks the validation set into your choices, so it can no longer be a clean final judge.
The Test Set Stays Sealed
Because validation guided your decisions, you need one untouched pile for the truth. Keep the test set sealed until you are completely done.
A Common Split
A typical starting point is roughly 80/10/10: most data for training, smaller slices for validation and test. Adjust based on how much data you have.
Split with random_split
PyTorch gives you random_split to carve a dataset into pieces by length. It shuffles which samples land in each set for you.
from torch.utils.data import random_split
train, val, test = random_split(ds, [800, 100, 100])Seed for Reproducible Splits
The split is random, so set a seed if you want the same pieces every run. That keeps experiments comparable across sessions.
g = torch.Generator().manual_seed(42)
train, val, test = random_split(ds, [800, 100, 100], generator=g)Stratify for Balance
With rare classes, a plain random split may leave some out. Stratifying keeps each set's class mix close to the original so scores stay meaningful.
Never Peek at Test
The golden rule is simple: do not let the test set shape any decision. The moment it does, your final number stops being trustworthy.
Quick Check
Which set should you look at only once, at the very end?
Recap
Three sets, three jobs: training teaches the model, validation guides your tuning, and test gives the final honest score. Keep test sealed until the end. 🎯
تعلم Python مع معلم ذكاء اصطناعي — مجانًا
اكتب وقم بتشغيل أكوادك الفعلية في المتصفح، واحصل على مساعدة فورية من معلم ذكاء اصطناعي متاح 24/7، واستمر من حيث توقفت على الويب أو في التطبيق.
- الدورات
- 30
- الدروس
- 120
الأسئلة الشائعة
هل درس «تقسيم بيانات التدريب والتحقق والاختبار» مجاني؟
نعم — نص درس «تقسيم بيانات التدريب والتحقق والاختبار» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Deep Learning Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Deep Learning Academy 4 دروس في المجموع.
ماذا ستتعلم في «تقسيم بيانات التدريب والتحقق والاختبار»؟
لماذا تحتاج إلى ثلاث مجموعات لا واحدة تتمرن على Deep Learning Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Deep Learning Academy؟
لا تُشترط خبرة سابقة. Deep Learning Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 1 من أصل 4.
كم من الوقت يستغرق درس «تقسيم بيانات التدريب والتحقق والاختبار»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Deep Learning Academy هذا؟
نعم. كل درس في Deep Learning Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- تقسيم بيانات التدريب والتحقق والاختبار
- حلقة Epoch مع التحقق
- الحفظ والتحميل باستخدام state_dict
- الإيقاف المبكر عند خسارة التحقق