Feature Engineering for Time Series

Time series shows up everywhere — stock prices, weather, energy consumption, vital signs, machine performance, web traffic. Most companies you'd never think of as "time series companies" are working on time series data. The raw signal is rarely the right input to a model — the features you engineer from it are.

  • Temporal features. Day of week, month, quarter, hour, time of day. Capture recurring patterns aligned with calendar or clock structure.
  • Lagged features. Past values of the variable as features for the current prediction. "Yesterday's sales" as a feature for today's. The model learns temporal dependencies — what came before predicts what comes next.
  • Rolling statistics. Moving averages, rolling standard deviations over sliding windows. Smooth out noise and reveal underlying trends. An Oura ring's daily relative body temperature looks like pure noise until you apply a 3–5 day rolling window, at which point a clear trend emerges.
  • Seasonal features. Patterns that repeat at regular intervals. US electricity demand has a textbook seasonal pattern: a big peak July through September when most of the country runs AC.
  • Frequency-domain features. Fourier transforms decompose the time series into frequency components. Useful when patterns are periodic — heart rate variability, vibration analysis, audio signals.
  • Autocorrelation features. Correlation between the series and a lagged version of itself. These help identify the temporal structure of the series and inform which lag features are worth engineering.
Time Series Decomposition
Trend strength0.80
Seasonal amplitude0.50
Noise level0.40
Raw signal-0.941.36
RawTrend
Trendlong-run direction of the seriesSeasonalrepeating calendar-driven cyclesResidualwhat's left after removing trend and seasonal

Adjust trend, seasonal amplitude, and noise to see how each component contributes to the raw signal. Switch to Decomposed view to isolate each layer.

Time Domain vs. Frequency Domain

The same signal, two ways of looking at it. Toggle frequency components on and off to see how they combine in the time domain — and how the frequency domain strips that complexity back to a clean list of what frequencies are present and how strong they are.

Signal components — click to toggle

Time Domain

amplitude over time

0s0.5s1s1.5s2s

The green composite is what you would actually record with a sensor — all frequencies mixed together, inseparable by eye. Hover a toggle to see that component as a faint dashed line.

Frequency Domain

amplitude at each frequency

70%1 Hz45%3 Hz28%7 Hz18%12 Hz

The frequency domain reveals exactly which frequencies are present and at what strength — something impossible to read from the time-domain waveform. This is what a Fourier transform gives you: a decomposition of any signal into its constituent frequencies.

Why this matters for sensor data

  • Time domain — tells you when something happened: a spike, a trend, a burst of activity.
  • Frequency domain — tells you what rhythms drive the signal: breathing rate, vibration modes, electrical noise at 50/60 Hz.
  • Feature engineering often requires both: time-domain statistics (mean, variance, peaks) for event detection; frequency-domain features (spectral power bands) for rhythm-based classification.

Toggle frequency components to see how they combine in the time domain — and how the frequency domain makes each component visible separately.

Forecasting at Every Scale

Demand forecasting in retail, load forecasting in utilities, patient deterioration prediction in hospitals, financial volatility forecasting — the specific features differ, but these six categories appear everywhere. Temporal features handle calendar effects. Lagged features handle autoregressive structure. Rolling stats handle trend extraction. Seasonal features handle recurring patterns. Frequency features handle periodic signals. Pick the categories that match your application's time scale and domain.

Checkpoint

You're predicting tomorrow's electricity demand. You include 'demand yesterday' (lag-1) as a feature. A colleague suggests also including 'demand one week ago' (lag-7). Why might lag-7 be valuable?