Skip to content

Type Alias: SeriesOperator

@kortexya/reasoninglayer


@kortexya/reasoninglayer / SeriesOperator

SeriesOperator = { op: "window_mean"; } | { op: "window_sum"; } | { op: "window_count"; } | { op: "window_variance"; } | { op: "window_min_max"; } | { op: "window_rate"; } | { alpha?: number; halfLife?: number; op: "ewma"; } | { op: "trend"; }

Defined in: src/types/temporal.ts:294

Which streaming aggregation to run over the ordered (timestamp, value) series.

A union discriminated by op. The window_* operators emit one point per bucket and require a bucketing SeriesWindowSpec. ewma and trend consume the whole ordered stream and require { windowing: 'none' }.

ewma takes exactly one of alpha (smoothing factor in (0, 1]) or halfLife (in number of observations).

const mean: SeriesOperator = { op: 'window_mean' };
const smoothed: SeriesOperator = { op: 'ewma', alpha: 0.3 };
const trend: SeriesOperator = { op: 'trend' };