netmap.model.zinbautoencoder.ZINBLoss

class netmap.model.zinbautoencoder.ZINBLoss(*args: Any, **kwargs: Any)[source]

Bases: Module

__init__(scale_factor=1.0, eps=1e-10, ridge_lambda=0.0)[source]

Zero-Inflated Negative Binomial loss module.

Parameters:
  • scale_factor (float) – Scale factor applied to predictions. Defaults to 1.0.

  • eps (float) – Small value for numerical stability. Defaults to 1e-10.

  • ridge_lambda (float) – Ridge regularisation weight for the zero-inflation probability (pi). Defaults to 0.0.

forward(y_true, y_pred, theta, pi)[source]

Compute the ZINB negative log-likelihood loss.

Parameters:
Returns:

Mean ZINB negative log-likelihood, optionally with

ridge penalty on pi.

Return type:

torch.Tensor