PoissonLoss

class PoissonLoss @JvmOverloads constructor(logInput: Boolean = true, epsilon: Float = 1.0E-8f) : Loss(source)

Poisson Negative Log Likelihood Loss.

Used for count data regression (predicting non-negative integers).

Poisson(pred, target) = pred - target * log(pred)

The prediction should be positive (typically the output of exp() or softplus()). The target should be non-negative (count data).

Note: This is the negative log likelihood of a Poisson distribution, without the factorial term (which doesn't affect optimization).

Parameters

logInput

If true, the input is in log-space (e.g., output of a linear layer) and will be exponentiated. If false, input should already be positive (e.g., output of softplus). Default is true.

epsilon

Small value for numerical stability when logInput is false. Default is 1e-8.

Constructors

Link copied to clipboard
constructor(logInput: Boolean = true, epsilon: Float = 1.0E-8f)

Functions

Link copied to clipboard
open override fun <T : DType, V> forward(preds: Tensor<T, V>, targets: Tensor<out DType, *>, ctx: ExecutionContext, reduction: Reduction): Tensor<T, V>