النوافذ المتحركة والإزاحات
التنعيم وإنشاء ميزات الإزاحة
النوافذ المتحركة والإزاحات درس مجاني في Data Science Academy على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Data Science Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Data Science Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
Smoothing Out the Bumps
Raw time series can be jumpy. A rolling window averages nearby points so the underlying signal becomes easy to see. 🌊
What a Window Really Is
A window is a fixed number of recent points. It slides forward one step at a time, recomputing a summary at each position.
The Rolling Mean
The most common move is a rolling mean: average the last few values to smooth the line. pandas makes it a one-liner.
sales.rolling(window=7).mean()Window Size Is a Trade-Off
A larger window smooths more but reacts slowly; a smaller one stays responsive but noisy. You tune it to the question.
The First Values Are NaN
A window of 7 needs 7 points before it can compute. So the first rows come back as NaN until enough history exists.
Beyond the Mean
Rolling works with more than averages. A rolling std reveals how volatility changes over time, which trends alone hide.
sales.rolling(window=30).std()Meet the Lag
A lag is simply the value from an earlier time step. Yesterday's sales as a column is a lag-1 feature.
Shift Creates Lags
pandas builds lags with shift. Calling shift(1) pushes every value down one row so each row sees its past.
df['lag_1'] = sales.shift(1)Why Lags Power Forecasts
Most series depend on their own recent past. Feeding a model good lag features lets it learn that yesterday predicts today.
Differencing Is a Lag Too
Subtracting the previous value, value minus its lag, gives the change between steps. It is the seed of differencing.
df['change'] = sales - sales.shift(1)Combine Rolling and Lags
Strong feature sets often mix both: a few lags plus a rolling mean. Together they capture recent level and direction.
Quick Check
Which pandas method shifts values to their previous time step to build a lag feature?
Recap: Past as Features
You used rolling windows to smooth and lags via shift to bring the past forward, the two staples of time series features.
الأسئلة الشائعة
هل درس «النوافذ المتحركة والإزاحات» مجاني؟
نعم — نص درس «النوافذ المتحركة والإزاحات» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Data Science Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Data Science Academy 4 دروس في المجموع.
ماذا ستتعلم في «النوافذ المتحركة والإزاحات»؟
التنعيم وإنشاء ميزات الإزاحة تتمرن على Data Science Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Data Science Academy؟
لا تُشترط خبرة سابقة. Data Science Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.
كم من الوقت يستغرق درس «النوافذ المتحركة والإزاحات»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Data Science Academy هذا؟
نعم. كل درس في Data Science Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- الاتجاه والموسمية والضوضاء
- النوافذ المتحركة والإزاحات
- الثبات والفروق
- خط أساس أول للتنبؤ