Feature Engineering for Time Series
Feature engineering for time series turns timestamps, earlier observations, and data known at prediction time into model inputs. It helps a forecasting or time-dependent model represent recurring calendar patterns, recent behavior, and changes without using information from the future.
itArtificial intelligence and machine learning | OpenSkills.info
Intro
Feature Engineering for Time Series
Feature engineering for time series converts an ordered history into inputs a model can use at a defined prediction time. The central constraint is availability: each feature in the row for time t must be computable using information available at t. A feature that depends on a later observation describes the answer rather than the information available to make the prediction.
A tabular model expects one row per example. For a forecast horizon of one period, a row can contain demand at earlier periods, the current timestamp's calendar fields, and a weather forecast issued before that timestamp. The target is demand at the next period. The same pattern supports anomaly detection, classification, and regression, but the target and availability rule must be stated before features are built.
The time-aware feature row
Start by defining four things:
Continue the course
This section is part of the paid course.
See pricing to subscribe, or log in if you already have access.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://scikit-learn.org/stable/auto_examples/applications/plot_cyclical_feature_engineering.html
Supports
- Timestamp-derived hour, weekday, month, holiday, and working-day inputs
- Periodic feature engineering and time-sensitive cross-validation
- Calendar-feature claims in the intro, slides, cheatsheet, quiz, and infographic
- https://scikit-learn.org/stable/auto_examples/applications/plot_time_series_lagged_features.html
Supports
- Lagged feature matrices for time-series forecasting
- Temporal dependence, leakage risk, chronological evaluation, and quantile prediction examples
- Cutoff, lag, leakage, and external-value availability claims in learner artifacts and quiz
- https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.TimeSeriesSplit.html
Supports
- Time-ordered train and test indices, expanding training sets, equally spaced samples, and gap behavior
- Time-aware validation claims and quiz answers
- https://pandas.pydata.org/docs/user_guide/timeseries.html
Supports
- Datetime parsing, timezone conversion, frequency conversion, and time-based resampling
- Resampling claims in the intro, slides, cheatsheet, and quiz
- https://pandas.pydata.org/docs/user_guide/window.html
Supports
- Rolling, expanding, and time-based window operations
- Trailing-window distinctions in cheatsheet, links, and quiz
- https://otexts.com/fpp3/features.html
Supports
- Time-series features as numerical summaries useful for exploration
- The reference-path rationale for broader forecasting study
- https://github.com/sindresorhus/awesome
Supports
- Discovery path from the root awesome index to data-science and machine-learning lists
- https://github.com/krzjoa/awesome-python-data-science
Supports
- Selection of sktime, skforecast, and tsfresh from time-series and feature-engineering sections
- https://www.sktime.net/
Supports
- sktime rationale as a unified framework for forecasting, feature extraction, and related time-series tasks
- https://skforecast.org/latest/
Supports
- skforecast rationale for time-series forecasting with scikit-learn-compatible estimators and documented feature-engineering workflows
- https://tsfresh.readthedocs.io/en/latest/
Supports
- tsfresh rationale for automated extraction of relevant time-series features
