Per-window scalers for TCN: robust (the default) and identity.
Scaler
chronax.tcn_scaler.Scaler
A protocol defining the interface for per-window scalers.
stats(self, x, axis=1)
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
jnp.ndarray |
- | (undocumented) |
axis |
int |
1 |
(undocumented) |
transform(self, x, shift, scale)
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
jnp.ndarray |
- | (undocumented) |
shift |
jnp.ndarray |
- | (undocumented) |
scale |
jnp.ndarray |
- | (undocumented) |
inverse(self, z, shift, scale)
| Parameter | Type | Default | Description |
|---|---|---|---|
z |
jnp.ndarray |
- | (undocumented) |
shift |
jnp.ndarray |
- | (undocumented) |
scale |
jnp.ndarray |
- | (undocumented) |
IdentityScaler
chronax.tcn_scaler.IdentityScaler
No-op scaler (shift=0, scale=1). Matches neuralforecast's scaler_type='identity'.
stats(self, x, axis=1) -> tuple[jnp.ndarray, jnp.ndarray]
| 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) -> jnp.ndarray
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
jnp.ndarray |
- | (undocumented) |
shift |
jnp.ndarray |
- | (undocumented) |
scale |
jnp.ndarray |
- | (undocumented) |
Returns: jnp.ndarray
inverse(self, z, shift, scale) -> jnp.ndarray
| Parameter | Type | Default | Description |
|---|---|---|---|
z |
jnp.ndarray |
- | (undocumented) |
shift |
jnp.ndarray |
- | (undocumented) |
scale |
jnp.ndarray |
- | (undocumented) |
Returns: jnp.ndarray
RobustScaler
chronax.tcn_scaler.RobustScaler
Median + MAD scaler with a 0.6745*std fallback when MAD is zero.
The shift is the window median and the scale is the median absolute deviation median(|x - median|). Where MAD is zero the scale falls back to 0.6745*std; exact zeros are then pinned to 1.0 and eps is added. Mirrors neuralforecast's robust_statistics.
stats(self, x, axis=1) -> tuple[jnp.ndarray, jnp.ndarray]
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
jnp.ndarray |
- | (undocumented) |
axis |
int |
1 |
(undocumented) |
Returns: tuple[jnp.ndarray, jnp.ndarray]
transform(self, x, shift, scale) -> jnp.ndarray
| Parameter | Type | Default | Description |
|---|---|---|---|
x |
jnp.ndarray |
- | (undocumented) |
shift |
jnp.ndarray |
- | (undocumented) |
scale |
jnp.ndarray |
- | (undocumented) |
Returns: jnp.ndarray
inverse(self, z, shift, scale) -> jnp.ndarray
| Parameter | Type | Default | Description |
|---|---|---|---|
z |
jnp.ndarray |
- | (undocumented) |
shift |
jnp.ndarray |
- | (undocumented) |
scale |
jnp.ndarray |
- | (undocumented) |
Returns: jnp.ndarray
resolve_scaler
chronax.tcn_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