Skip to content

Type Alias: SeriesWindowSpec

@kortexya/reasoninglayer


@kortexya/reasoninglayer / Temporal / SeriesWindowSpec

Type Alias: SeriesWindowSpec

SeriesWindowSpec = { anchor?: number; sizeMs: number; windowing: "tumbling"; } | { anchor?: number; sizeMs: number; slideMs: number; windowing: "sliding"; } | { gapMs: number; windowing: "session"; } | { windowing: "none"; }

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

How to bucket time.

Remarks

A union discriminated by windowing. tumbling produces non-overlapping fixed buckets; sliding produces overlapping hopping buckets; session groups by inactivity gap; none treats the whole ordered series as one stream (the required choice for ewma and trend).

anchor (bucket-0 start, epoch-milliseconds) defaults to the minimum observed timestamp. All durations are milliseconds.

Example

const hourly: SeriesWindowSpec = { windowing: 'tumbling', sizeMs: 3_600_000 };
const rolling: SeriesWindowSpec = { windowing: 'sliding', sizeMs: 3_600_000, slideMs: 300_000 };
const whole: SeriesWindowSpec = { windowing: 'none' };