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.

chronax.nlinear_losses

Pluggable point-loss functions for the NLinear 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) — matching neuralforecast's _weighted_mean, used to drop right-padded horizon steps from the training loss.

mae(pred, target, mask=None)

chronax.nlinear_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(pred, target, mask=None)

chronax.nlinear_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(pred, target, mask=None)

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

resolve(loss)

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

LOSSES

chronax.nlinear_losses.LOSSES

A mapping of available loss names to their corresponding functions.

Type: Mapping[str, LossFn]