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
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic — Feature Engineering for Time Series
Feature engineering for time series is the art of turning an ordered history into rows a model can use, with one rule that makes it harder than the tabular kind: every feature in the row for time t must be computable using only information available at t. A feature that reads from the future is not a feature. It is a leak.
The first idea to hold is the cutoff time — the latest moment the prediction is allowed to know about. Pick it. That is the boundary between information and answer. A lag is a value from an earlier period of the same series: the demand one hour ago, the count from yesterday, the reading from a week ago. Trailing windows summarize recent level and variation: mean, standard deviation, min, max — all ending at or before the cutoff. They describe history without peeking.
Timestamps carry structure too. Calendar features — hour, weekday, month, holiday status — describe recurring conditions known in advance. Resampling aligns irregular events to a uniform grid so rows become comparable. An exogenous feature (a weather forecast, a published schedule) is valid only when the value used would have been available at the cutoff. A later corrected observation is not the same thing.
Evaluation follows the same discipline. A random split breaks the temporal story by training on future observations and testing on past ones, which makes the score look better than a live forecast deserves. Time-aware validation keeps the training set before the test set and expands the training window across folds. Build every learned transformation inside the training portion of each split so the offline pipeline matches the online one.
Leakage hides in future lags, centered rolling windows, global aggregates computed over all rows, randomly shuffled train and test splits, and external values used at their event time rather than their publication time. Missing timestamps are another hazard: a lag measured in row count may no longer mean a fixed duration.
The cheatsheet covers the feature families, window semantics, and the leakage scan checklist. The practice reference and exercise turn the rules into a pandas and scikit-learn pipeline. The Reference tab carries the path into scikit-learn's time-series examples and Forecasting: Principles and Practice. The Timeline tab traces how the field moved from manual lag engineering through automated extraction to frameworks that bake temporal awareness into the feature contract.
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
- https://docs.functime.ai/
Supports
- functime rationale for Polars-native time-series feature extraction with speed improvements over tsfresh
- https://business-science.github.io/pytimetk/
Supports
- pytimetk rationale for unified time-series feature engineering across pandas and Polars engines
- https://docs.featuretools.com/en/latest/guides/time_series.html
Supports
- Featuretools time-series guide with gap and window parameter design for feature engineering windows
- https://temporian.readthedocs.io/en/stable/
Supports
- Temporian rationale for leakage-prevention-by-default temporal feature computation
- https://arxiv.org/abs/1910.12808
Supports
- Catch22 distillation of HCTSA to twenty-two high-discriminative-power features
- https://facebookresearch.github.io/Kats/
Supports
- Kats rationale as a lightweight time-series toolkit for rapid prototyping
- https://otexts.com/fpp3/
Supports
- Statistical foundations of time-series analysis including AR, MA, and ARIMA modeling
- https://arxiv.org/abs/1610.07717
Supports
- HCTSA framework extracting over seven thousand time-series features
- Distributed and parallel feature extraction algorithm design
- https://arxiv.org/abs/1610.07717
Supports
- FRESH algorithm description and distributed feature extraction architecture
- https://doi.org/10.1016/j.neucom.2018.03.067
Supports
- Peer-reviewed formalization of the FRESH algorithm and filtering procedure
- https://arxiv.org/abs/1909.07872
Supports
- sktime unified interface for machine learning with time series
- https://github.com/blue-yonder/tsfresh/releases
Supports
- Version history and release dates for tsfresh feature extraction library
