Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

name: op-win-ewma
description: Exponentially weighted moving average; s_i = alpha*x_i + (1-alpha)*s_{i-1}.
kind: operator
category: WIN
operator: WIN_EWMA
type: reference
applies_to: process, compose, predict
examples_tags: [time-series, window-operator, buffered-pipeline]

Window operators emit row-level values; they do not produce Response.Components.

Use when

Adds a smoothed series: each new value counts for a fixed share w, the previous smoothed level for 1 - w, so older values fade.

Questions it answers:

  • What is the underlying level of daily demand once day-to-day noise is damped?
  • Is the smoothed defect rate drifting up over recent batches?

Use something else:

  • WIN_MOVING_AVG when you want every row in a fixed window to count equally.

Params

NameTypeDefaultDescription
alphafloat—Smoothing factor in (0, 1]; higher = more weight on recent.
decayfloat—Carry-over share in [0, 1) (adstock decay); alpha = 1 − decay.

Give EXACTLY ONE of alpha / decay (manifest exactly_one_of: smoothing; a Recommend draft names alpha).

partition_by (carve), order_by (≥1, required, numeric / date), frame (REQUIRED {mode: "rows"}; ignored by the recurrence — manifest ignores_frame). field (required, numeric).

Inputs

ParamAccepted field types
Fieldnumeric: u4/u8/u16/u32/u64, f32/f64, date (no decimal128, categorical, packed_bool)

Output

One float64 per row written to Label (default WIN_EWMA_<field>). Recurrence seeds from the first non-null value in the partition.

Reading the output

  • value: A smoothed level of the field: s = alpha * current + (1 - alpha) * previous s, seeded with the partition’s first value present. A value k rows back carries weight alpha * (1 - alpha)^k, so alpha near 1 follows the latest value closely and alpha near 0 changes slowly.
    • Caveat: The seed enters at full weight, so the start of each partition leans on the first value: with alpha 0.1 it still carries about 35% of the weight ten rows later (0.9^10). Read the early rows with care.

Gotchas

  • Not weightable: a request weight is PROCESSING_CONFIG (windows carry no slot weight); Options.DefaultWeight is skipped.
  • Exactly one of alpha / decay — both, neither, alpha outside (0, 1] or decay outside [0, 1) → PULSE_WINDOW_INVALID (runtime PROCESSING_CONFIG).
  • alpha = 1 − decay from the decay’s EXACT decimal: decay: 0.7 smooths bit-identically to alpha: 0.3 (not float 1 − 0.7). decay: 0 is alpha: 1 (identity).
  • Rows preceding the first non-null emit null (no seed).
  • Null values emit null but state survives through to the next non-null row.
  • Result rows are NOT reordered — use Request.Sort.
  • Forces buffered execution (Streamable=false).

See