مقاييس الانحدار: MAE وMSE وR2
قياس خطأ التنبؤات الرقمية
مقاييس الانحدار: MAE وMSE وR2 درس مجاني في Data Science Academy على CoddyKit. هذا هو الدرس 1 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Data Science Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Data Science Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
Why Measure Error
When a model predicts numbers, you need one honest score for how far off it is. That score is an error metric, your truth-teller. 📏
The Residual Idea
Start with the residual: the gap between the true value and the predicted one. Every regression metric is just a way to summarize these gaps.
residual = y_true - y_predMean Absolute Error
MAE takes the size of each error, ignores the sign, and averages them. It tells you the typical miss in the same units as your target.
from sklearn.metrics import mean_absolute_error
mean_absolute_error(y_true, y_pred)MAE Is Easy to Explain
Because MAE stays in real units, you can say the model is off by about 5 dollars on average. Stakeholders love that plain reading.
Mean Squared Error
MSE squares each error before averaging. Squaring punishes big misses much harder, so a few large errors dominate the score.
from sklearn.metrics import mean_squared_error
mean_squared_error(y_true, y_pred)Squaring Changes the Units
One catch: MSE is in squared units, so dollars become squared dollars. The number is hard to interpret on its own.
Root Mean Squared Error
Take the square root of MSE to get RMSE, back in normal units. It keeps the heavy penalty on big errors but reads cleanly.
rmse = mean_squared_error(y_true, y_pred) ** 0.5MAE vs RMSE
Choose MAE when every error matters equally, and RMSE when large mistakes are especially costly and you want them penalized more.
The R-Squared Score
R2 asks a different question: what fraction of the variation in the target your model explains. Higher means a better fit.
from sklearn.metrics import r2_score
r2_score(y_true, y_pred)Reading R-Squared
An R2 of 1.0 is perfect, 0.0 is no better than guessing the mean. It can even go negative when a model fits worse than that.
Use Them Together
No single number tells the whole story. Pair an error metric like RMSE with R2 to see both the typical miss and the overall fit.
Quick Check
Let's pin down what each regression metric really measures.
Recap
Use MAE for plain average error, RMSE to punish big misses, and R2 for fraction of variance explained. Read them together. 🎯
الأسئلة الشائعة
هل درس «مقاييس الانحدار: MAE وMSE وR2» مجاني؟
نعم — نص درس «مقاييس الانحدار: MAE وMSE وR2» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Data Science Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Data Science Academy 4 دروس في المجموع.
ماذا ستتعلم في «مقاييس الانحدار: MAE وMSE وR2»؟
قياس خطأ التنبؤات الرقمية تتمرن على Data Science Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Data Science Academy؟
لا تُشترط خبرة سابقة. Data Science Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 1 من أصل 4.
كم من الوقت يستغرق درس «مقاييس الانحدار: MAE وMSE وR2»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Data Science Academy هذا؟
نعم. كل درس في Data Science Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- مقاييس الانحدار: MAE وMSE وR2
- فك رموز مصفوفة الالتباس
- Precision وRecall وF1
- ROC وAUC والعتبات