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.

nlinear_scaler

Per-window scalers for NLinear: 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

chronax.nlinear_scaler.Scaler

A protocol defining the interface for Chronax scalers.

stats(self, x, axis=1)

Calculates the shift and scale parameters from the input data.

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

Returns: tuple[jnp.ndarray, jnp.ndarray]

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

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

IdentityScaler

chronax.nlinear_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]

transform(self, x, shift, scale)

Returns x 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 z unchanged.

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

Returns: jnp.ndarray

RobustScaler

chronax.nlinear_scaler.RobustScaler

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

stats(self, x, axis=1)

Calculates the median (shift) and the MAD (scale), using 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]

transform(self, x, shift, scale)

Applies the median/MAD 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 the inverse median/MAD 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

chronax.nlinear_scaler.resolve_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