0Pricing
Data Science Academy · درس

الثبات والفروق

تهيئة سلسلة للنمذجة

الثبات والفروق درس مجاني في Data Science Academy على CoddyKit. هذا هو الدرس 3 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Data Science Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Data Science Academy 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Models Like Steady Data

Most forecasting models assume the series behaves consistently over time. That property has a name: stationarity. 🎯

What Stationary Means

A stationary series has a stable mean and spread that do not drift over time. Its statistical mood stays the same.

Trends Break Stationarity

A rising trend means the mean keeps climbing, so the series is non-stationary. Many models will struggle until you fix that.

Seasonality Breaks It Too

Repeating seasonal swings make the average rise and fall on a cycle. That changing pattern also counts as non-stationary.

The ADF Test

You do not have to guess. The ADF test checks stationarity and returns a p-value you can read.

from statsmodels.tsa.stattools import adfuller
result = adfuller(sales)

Reading the P-Value

If the ADF p-value is below 0.05, the series is likely stationary. Above it, you probably still have a trend to remove.

Differencing to the Rescue

Differencing replaces each value with how much it changed from the last step. This simple move often erases a trend.

diffed = sales.diff()

Why It Removes Trends

By looking at changes instead of levels, a steady climb becomes a flat line wobbling around zero, which is stationary.

Drop the First NaN

The very first row has nothing to subtract, so diff leaves it NaN. Drop it before testing or modeling.

diffed = sales.diff().dropna()

Differencing Again

If one round is not enough, difference the result a second time. The number of rounds becomes the d term in ARIMA.

Seasonal Differencing

To kill a yearly cycle, subtract the value 12 steps back. That seasonal diff targets the repeating pattern directly.

seasonal = sales.diff(12)

Quick Check

An ADF test on your raw series returns a p-value of 0.40. What does that suggest?

Recap: Make It Steady

You learned to test stationarity with ADF and to remove trends and cycles using differencing before modeling.

الأسئلة الشائعة

هل درس «الثبات والفروق» مجاني؟

نعم — نص درس «الثبات والفروق» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Data Science Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Data Science Academy 4 دروس في المجموع.

ماذا ستتعلم في «الثبات والفروق»؟

تهيئة سلسلة للنمذجة تتمرن على Data Science Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Data Science Academy؟

لا تُشترط خبرة سابقة. Data Science Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 3 من أصل 4.

كم من الوقت يستغرق درس «الثبات والفروق»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Data Science Academy هذا؟

نعم. كل درس في Data Science Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. الاتجاه والموسمية والضوضاء
  2. النوافذ المتحركة والإزاحات
  3. الثبات والفروق
  4. خط أساس أول للتنبؤ
← العودة إلى Data Science Academy