chronax.loss
Loss functions for the Chronax FEDformer model (self-contained, pure JAX). The objective functions optimised during training and used for validation.
mae
chronax.loss.mae
Mean Absolute Error; masked mean when mask is given (NF padder).
| Parameter | Type | Default | Description |
|---|---|---|---|
pred |
jnp.ndarray |
- | (undocumented) |
target |
jnp.ndarray |
- | (undocumented) |
mask |
Optional[jnp.ndarray] |
None |
(undocumented) |
mse
chronax.loss.mse
Mean Squared Error; masked mean when mask is given.
| Parameter | Type | Default | Description |
|---|---|---|---|
pred |
jnp.ndarray |
- | (undocumented) |
target |
jnp.ndarray |
- | (undocumented) |
mask |
Optional[jnp.ndarray] |
None |
(undocumented) |
huber
chronax.loss.huber
Huber loss with delta = 1.0 (smooth L1); masked mean when mask is given.
Quadratic for small residuals (|r| <= 1) and linear beyond, giving the smooth gradients of MSE near zero with the outlier-robustness of MAE in the tails.
| Parameter | Type | Default | Description |
|---|---|---|---|
pred |
jnp.ndarray |
- | (undocumented) |
target |
jnp.ndarray |
- | (undocumented) |
mask |
Optional[jnp.ndarray] |
None |
(undocumented) |
LOSSES
chronax.loss.LOSSES
Registry of built-in window losses, addressable by name.
Type: Mapping[str, LossFn]
resolve
chronax.loss.resolve
Return a loss callable from a registry key or pass a callable through.
| Parameter | Type | Default | Description |
|---|---|---|---|
loss |
str \| LossFn |
- | Either a registry key ("mae" / "mse" / "huber") or any (pred, target) -> scalar callable. |
Returns: LossFn (the resolved loss callable).
Raises: ValueError (If loss is an unknown string key.)
masked_mae
chronax.loss.masked_mae
Mean Absolute Error with multiplicative masking.
| Parameter | Type | Default | Description |
|---|---|---|---|
y |
jnp.ndarray |
- | Target values [B, H, 1]. |
y_hat |
jnp.ndarray |
- | Predictions [B, H, 1]. |
mask |
Optional[jnp.ndarray] |
None |
Optional [B, H, 1] mask (1 = include, 0 = ignore). |
horizon_weight |
Optional[jnp.ndarray] |
None |
Optional [H] per-step weights. |
masked_mse
chronax.loss.masked_mse
Mean Squared Error with multiplicative masking (see :func:masked_mae).
| Parameter | Type | Default | Description |
|---|---|---|---|
y |
jnp.ndarray |
- | (undocumented) |
y_hat |
jnp.ndarray |
- | (undocumented) |
mask |
Optional[jnp.ndarray] |
None |
(undocumented) |
horizon_weight |
Optional[jnp.ndarray] |
None |
(undocumented) |
| ``` |