Pluggable losses for the StemGNN forecaster.
Point losses keep the shared signature (pred, target) -> scalar and reduce by mean. MultiQuantileLoss is the multi-quantile (pinball) loss. Every loss carries an outputsize_multiplier so the network's output head width is loss-driven. All are module-level / class-based so a fitted estimator pickles cleanly.
mae
stemgnn_losses.mae
Mean absolute error.
| Parameter | Type | Default | Description |
|---|---|---|---|
pred |
jnp.ndarray |
- | (undocumented) |
target |
jnp.ndarray |
- | (undocumented) |
Returns: jnp.ndarray (scalar mean loss).
mse
stemgnn_losses.mse
Mean squared error.
| Parameter | Type | Default | Description |
|---|---|---|---|
pred |
jnp.ndarray |
- | (undocumented) |
target |
jnp.ndarray |
- | (undocumented) |
Returns: jnp.ndarray (scalar mean loss).
huber
stemgnn_losses.huber
Huber loss, delta = 1.0.
| Parameter | Type | Default | Description |
|---|---|---|---|
pred |
jnp.ndarray |
- | (undocumented) |
target |
jnp.ndarray |
- | (undocumented) |
Returns: jnp.ndarray (scalar mean loss).
MultiQuantileLoss
stemgnn_losses.MultiQuantileLoss
Multi-quantile (pinball) loss. __call__(pred[...,h,Q], target[...,h]).
QL(y, y_hat, q) = q*(y-y_hat)+ + (1-q)*(y_hat-y)+, averaged over quantiles and all elements. Quantiles are sorted, must lie in (0, 1), and must include 0.5 (the median / "mean" head). Picklable (holds a plain tuple).
__init__(self, quantiles=(0.1, 0.5, 0.9))
| Parameter | Type | Default | Description |
|---|---|---|---|
quantiles |
Sequence[float] |
(0.1, 0.5, 0.9) |
(undocumented) |
__call__(self, pred, target) -> jnp.ndarray
| Parameter | Type | Default | Description |
|---|---|---|---|
pred |
jnp.ndarray |
- | (undocumented) |
target |
jnp.ndarray |
- | (undocumented) |
Returns: jnp.ndarray (scalar mean loss).
outputsize_multiplier
stemgnn_losses.outputsize_multiplier
Output-head width implied by loss (1 for point losses).
| Parameter | Type | Default | Description |
|---|---|---|---|
loss |
- | - | (undocumented) |
Returns: int.
resolve
stemgnn_losses.resolve
Return a callable loss from a registry string, a callable, or an MQ instance.
| Parameter | Type | Default | Description |
|---|---|---|---|
loss |
str | LossFn | MultiQuantileLoss |
- | (undocumented) |
Returns: Callable loss function.