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.

Module chronax.models.patchtst_losses

Pluggable point-loss functions for the PatchTST forecaster.

Self-contained (no dependency on other models' loss modules). Each loss has signature (pred, target) -> scalar and reduces by mean over all elements. Functions are module-level so they pickle cleanly when stored as the loss attribute of a fitted chronax.models.patchtst.PatchTST.

mae

chronax.models.patchtst_losses.mae

Mean absolute error: mean(|pred - target|).

mae(pred, target)

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

Returns: jnp.ndarray (The calculated loss value.)

mse

chronax.models.patchtst_losses.mse

Mean squared error: mean((pred - target)**2).

mse(pred, target)

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

Returns: jnp.ndarray (The calculated loss value.)

huber

chronax.models.patchtst_losses.huber

Huber loss with delta = 1.0. Quadratic for |r| <= 1, linear outside.

huber(pred, target)

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

Returns: jnp.ndarray (The calculated loss value.)

resolve

chronax.models.patchtst_losses.resolve

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

resolve(loss)

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

Returns: LossFn (The resolved callable loss function.)

LOSSES

chronax.models.patchtst_losses.LOSSES

A mapping of available loss function names to their implementations.

Type: Mapping[str, LossFn] Value: {"mae": mae, "mse": mse, "huber": huber}