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.

mae

chronax.tcn_losses.mae

Mean absolute error.

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

Returns: jnp.ndarray (The mean absolute error loss.)

mse

chronax.tcn_losses.mse

Mean squared error.

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

Returns: jnp.ndarray (The mean squared error loss.)

huber

chronax.tcn_losses.huber

Huber loss, delta = 1.0.

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

Returns: jnp.ndarray (The Huber loss.)

MultiQuantileLoss

chronax.tcn_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))

Initializes the MultiQuantileLoss instance.

Parameter Type Default Description
quantiles Sequence[float] (0.1, 0.5, 0.9) Quantiles to use for the loss calculation. Quantiles must be strictly between 0 and 1 and must include 0.5 (the median head).

__call__(self, pred, target)

Calculates the multi-quantile pinball loss.

Parameter Type Default Description
pred jnp.ndarray - Prediction array, expected shape [..., h, Q], where Q is the number of quantiles.
target jnp.ndarray - Target array, expected shape [..., h].

Returns: jnp.ndarray (The scalar mean pinball loss.)

outputsize_multiplier

chronax.tcn_losses.outputsize_multiplier

Output-head width implied by loss (1 for point losses).

Parameter Type Default Description
loss - - (undocumented)

Returns: int (The implied output head width.)

resolve

chronax.tcn_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: (A callable loss function.)

Raises:

Exception Description
ValueError If the provided string loss name is unknown.