ma_window – Trailing moving average over a fixed window.#

Back to op axis | Back to L3 | Browse all options

Operational op under axis op, sub-layer L3_A_step_op, layer l3. Standalone callable: mf.functions.ma_window_transform.

Function signature#

mf.functions.ma_window_transform(
    panel: pd.DataFrame,
    window: int,
) -> pd.DataFrame

Parameters#

name

type

default

constraint

description

panel

pd.DataFrame

Input panel. Each column is a variable; rows are time periods. Series is promoted to a single-column DataFrame internally.

window

int

3

>= 1

Rolling window size in periods. First window-1 rows are NaN.

Returns#

pd.DataFrame — scalar result.

Behavior#

Computes mean(y_{t-w+1..t}) for a user-specified window params.window. temporal_rule controls expanding vs rolling vs block-wise refit semantics. The first w-1 rows are NaN.

When to use

Smoothing noisy series; building short / medium / long-term momentum features.

In recipe context#

Set params.op = "ma_window" in the relevant layer to activate this op within a recipe:

# Layer L3 recipe fragment
params:
  op: ma_window

References#

  • macroforecast design Part 2, L3: ‘feature engineering is a DAG of typed transforms; cascade-depth bounds the longest chain at cascade_max_depth.’