nichecompass.modules.compute_omics_recon_nb_loss

nichecompass.modules.compute_omics_recon_nb_loss(x, mu, theta, eps=1e-08)

Compute omics reconstruction loss according to a negative binomial model, which is often used to model omics count data such as scRNA-seq or scATAC-seq data.

Parts of the implementation are adapted from Lopez, R., Regier, J., Cole, M. B., Jordan, M. I. & Yosef, N. Deep generative modeling for single-cell transcriptomics. Nat. Methods 15, 1053–1058 (2018) -> https://github.com/scverse/scvi-tools/blob/main/scvi/distributions/_negative_binomial.py#L75; 29.11.2022.

Parameters:
  • x (Tensor) – Reconstructed feature vector (dim: batch_size, n_genes; nodes that are in current batch beyond originally sampled batch_size for message passing reasons are not considered).

  • mu (Tensor) – Mean of the negative binomial with positive support. (dim: batch_size x n_genes)

  • theta (Tensor) – Inverse dispersion parameter with positive support. (dim: n_genes)

  • eps (float (default: 1e-08)) – Numerical stability constant.

Return type:

Tensor

Returns:

nb_loss: Omics reconstruction loss using a negative binomial model.