Esc
Ask AIAnswers may be inaccurate; check the linked pages.Esc
Ask anything about these docs, like how to get started or what a function does.

tft_scaler

Per-window scalers for TFT: identity (NF default) and robust (median/MAD).

Self-contained (no cross-model import). Pure functions exposing (stats, transform, inverse) so the same shift/scale is reused for inverse.

Scaler

tft_scaler.Scaler · implements Protocol

A runtime checkable protocol defining the interface for per-window scalers.

stats(self, x, axis=1)

Calculates the shift and scale parameters required for transformation.

Parameter Type Default Description
x jnp.ndarray - (undocumented)
axis int 1 (undocumented)

Returns: tuple[jnp.ndarray, jnp.ndarray] (shift, scale).

transform(self, x, shift, scale)

Applies the scaling transformation.

Parameter Type Default Description
x jnp.ndarray - (undocumented)
shift jnp.ndarray - (undocumented)
scale jnp.ndarray - (undocumented)

Returns: jnp.ndarray (the transformed array).

inverse(self, z, shift, scale)

Applies the inverse scaling transformation.

Parameter Type Default Description
z jnp.ndarray - (undocumented)
shift jnp.ndarray - (undocumented)
scale jnp.ndarray - (undocumented)

Returns: jnp.ndarray (the inverse transformed array).

IdentityScaler

tft_scaler.IdentityScaler

No-op scaler (shift=0, scale=1). Matches neuralforecast's scaler_type='identity'.

stats(self, x, axis=1)

Calculates the shift (zeros) and scale (ones) parameters.

Parameter Type Default Description
x jnp.ndarray - (undocumented)
axis int 1 (undocumented)

Returns: tuple[jnp.ndarray, jnp.ndarray] (shift, scale).

transform(self, x, shift, scale)

Returns the input array unchanged.

Parameter Type Default Description
x jnp.ndarray - (undocumented)
shift jnp.ndarray - (undocumented)
scale jnp.ndarray - (undocumented)

Returns: jnp.ndarray.

inverse(self, z, shift, scale)

Returns the input array unchanged.

Parameter Type Default Description
z jnp.ndarray - (undocumented)
shift jnp.ndarray - (undocumented)
scale jnp.ndarray - (undocumented)

Returns: jnp.ndarray.

RobustScaler

tft_scaler.RobustScaler

Median + MAD scaler with 0.6745*std fallback when MAD=0.

stats(self, x, axis=1)

Calculates the median (shift) and MAD (scale), using a scaled standard deviation fallback if MAD is zero.

Parameter Type Default Description
x jnp.ndarray - (undocumented)
axis int 1 (undocumented)

Returns: tuple[jnp.ndarray, jnp.ndarray] (median, scale).

transform(self, x, shift, scale)

Applies robust scaling: (x - shift) / scale.

Parameter Type Default Description
x jnp.ndarray - (undocumented)
shift jnp.ndarray - (undocumented)
scale jnp.ndarray - (undocumented)

Returns: jnp.ndarray.

inverse(self, z, shift, scale)

Applies inverse robust scaling: z * scale + shift.

Parameter Type Default Description
z jnp.ndarray - (undocumented)
shift jnp.ndarray - (undocumented)
scale jnp.ndarray - (undocumented)

Returns: jnp.ndarray.

resolve_scaler

tft_scaler.resolve_scaler(scaler)

Resolve a scaler from a name ('identity'/'robust') or a Scaler instance.

Parameter Type Default Description
scaler str \| Scaler - (undocumented)

Returns: Scaler.

Raises: * ValueError: If an unknown scaler name is provided.