DecoderTOTALVI

class scvi.models.modules.DecoderTOTALVI(n_input, n_output_genes, n_output_proteins, n_cat_list=None, n_layers=1, n_hidden=256, dropout_rate=0)[source]

Bases: torch.nn.modules.module.Module

Decodes data from latent space of n_input dimensions n_output dimensions using a linear decoder

Parameters
  • n_input (intint) – The dimensionality of the input (latent space)

  • n_output_genes (intint) – The dimensionality of the output (gene space)

  • n_output_proteins (intint) – The dimensionality of the output (protein space)

  • n_cat_list (Iterable[int], NoneOptional[Iterable[int]]) – A list containing the number of categories for each category of interest. Each category will be included using a one-hot encoding

Returns

Methods Summary

forward(z, library_gene, *cat_list)

The forward computation for a single sample.

Methods Documentation

forward(z, library_gene, *cat_list)[source]

The forward computation for a single sample.

  1. Decodes the data from the latent space using the decoder network

  2. Returns local parameters for the ZINB distribution for genes

  3. Returns local parameters for the Mixture NB distribution for proteins

We use the dictionary px_ to contain the parameters of the ZINB/NB for genes. The rate refers to the mean of the NB, dropout refers to Bernoulli mixing parameters. scale refers to the quanity upon which differential expression is performed. For genes, this can be viewed as the mean of the underlying gamma distribution.

We use the dictionary py_ to contain the parameters of the Mixture NB distribution for proteins. rate_fore refers to foreground mean, while rate_back refers to background mean. scale refers to foreground mean adjusted for background probability and scaled to reside in simplex. back_alpha and back_beta are the posterior parameters for rate_back. fore_scale is the scaling factor that enforces rate_fore > rate_back.

Parameters
  • z (TensorTensor) – tensor with shape (n_input,)

  • library_gene (TensorTensor) – library size

  • cat_list (intint) – list of category membership(s) for this sample

Returns

3-tuple (first 2-tuple dict, last torch.Tensor) parameters for the ZINB distribution of expression