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.

Pluggable point-loss functions for the DLinear forecaster (self-contained). Each loss has signature (pred, target, mask=None) -> scalar. When mask is given it is a per-element 0/1 weight and the reduction is the masked mean sum(loss*mask)/sum(mask) (denominator clipped to >= 1, which equals NF's divide-no-nan on an all-masked batch) — matching neuralforecast's _weighted_mean, used to drop right-padded horizon steps from the training loss.

mae

dlinear_losses.mae

Mean absolute error (masked mean when mask is given).

Parameter Type Default Description
pred jnp.ndarray - (undocumented)
target jnp.ndarray - (undocumented)
mask jnp.ndarray | None None (undocumented)

Returns: jnp.ndarray

mse

dlinear_losses.mse

Mean squared error (masked mean when mask is given).

Parameter Type Default Description
pred jnp.ndarray - (undocumented)
target jnp.ndarray - (undocumented)
mask jnp.ndarray | None None (undocumented)

Returns: jnp.ndarray

huber

dlinear_losses.huber

Huber loss with delta = 1.0 (masked mean when mask is given).

Parameter Type Default Description
pred jnp.ndarray - (undocumented)
target jnp.ndarray - (undocumented)
mask jnp.ndarray | None None (undocumented)

Returns: jnp.ndarray

LOSSES

dlinear_losses.LOSSES

Mapping of available loss function names to their implementations.

Type: Mapping[str, LossFn]

resolve

dlinear_losses.resolve

Return a callable loss from either a registry string or a callable.

Callables receive (pred, target, mask); a custom loss should accept an optional mask (def my_loss(pred, target, mask=None): ...).

Parameter Type Default Description
loss str | LossFn - (undocumented)

Returns: LossFn

Raises: * ValueError