Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Engineering Multiple Lags | Section
Engineering Temporal Features

bookEngineering Multiple Lags

Swipe um das Menü anzuzeigen

Selecting the right lag intervals is crucial when you want to capture longer-term dependencies in time series data. Lag variables help your model learn from previous observations, but deciding which lags to include is a balancing act. Shorter lags, such as lag-1, can capture immediate effects, while longer lags like lag-3 or lag-7 might reveal weekly or other cyclical patterns. The choice depends on the frequency and seasonality of your data, as well as the specific patterns you expect to find. However, adding more lag features increases the dimensionality of your dataset, which can lead to overfitting and higher computational cost. You should always consider the trade-off between capturing more information and keeping your model simple and generalizable.

123456789101112131415
import pandas as pd # Example time series DataFrame data = { "date": pd.date_range(start="2024-01-01", periods=10, freq="D"), "value": [10, 12, 13, 15, 14, 16, 17, 19, 18, 20] } df = pd.DataFrame(data) # Generate multiple lag features: lag-1, lag-3, lag-7 df["lag_1"] = df["value"].shift(1) df["lag_3"] = df["value"].shift(3) df["lag_7"] = df["value"].shift(7) print(df)
copy
question mark

Which of the following is a potential risk of adding too many lag features to your time series model?

Select the correct answer

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 3

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

Abschnitt 1. Kapitel 3
some-alt