crested.tl.losses.PoissonLoss#

class crested.tl.losses.PoissonLoss(log_transform=True, eps=1e-07, reduction='sum_over_batch_size', name='PoissonLoss')#

Custom Poisson loss for count data with optional log(x + 1) transformation.

This loss function computes the Poisson loss, optionally applying log(x + 1) transformations to predictions and/or targets to ensure non-negativity.

Parameters:
  • log_transform (bool (default: True)) – If True, applies log(x + 1) transformation to both predictions and targets.

  • eps (float (default: 1e-07)) – Small value to avoid log(0).

  • reduction (str (default: 'sum_over_batch_size')) – Type of reduction to apply to the loss. Default: “sum_over_batch_size”.

Attributes table#

Methods table#

call(y_true, y_pred)

Compute the Poisson loss.

from_config(config)

get_config()

Return the configuration of the loss function.

Attributes#

PoissonLoss.dtype#

Methods#

PoissonLoss.call(y_true, y_pred)#

Compute the Poisson loss.

Parameters:
  • y_true – True target values (counts or log(x + 1)-transformed counts).

  • y_pred – Predicted values (counts or log(x + 1)-transformed counts).

Returns:

The Poisson loss value for each sample.

classmethod PoissonLoss.from_config(config)#
PoissonLoss.get_config()#

Return the configuration of the loss function.