scvi.external.methylvi.DecoderMETHYLVI#

class scvi.external.methylvi.DecoderMETHYLVI(n_input, n_output, n_cat_list=None, n_layers=1, n_hidden=128, inject_covariates=True, use_batch_norm=False, use_layer_norm=False, **kwargs)[source]#

Bases: Module

Decodes data from latent space of n_input dimensions into n_output dimensions.

Uses a fully-connected neural network of n_hidden layers.

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

  • n_output (int) – The dimensionality of the output (data space)

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

  • n_layers (int (default: 1)) – The number of fully-connected hidden layers

  • n_hidden (int (default: 128)) – The number of nodes per hidden layer

  • dropout_rate – Dropout rate to apply to each of the hidden layers

  • inject_covariates (bool (default: True)) – Whether to inject covariates in each layer, or just the first (default).

  • use_batch_norm (bool (default: False)) – Whether to use batch norm in layers

  • use_layer_norm (bool (default: False)) – Whether to use layer norm in layers

  • scale_activation – Activation layer to use for px_scale_decoder

  • **kwargs – Keyword args for FCLayers.

Attributes table#

Methods table#

forward(dispersion, z, *cat_list)

The forward computation for a single sample.

Attributes#

DecoderMETHYLVI.training: bool#

Methods#

DecoderMETHYLVI.forward(dispersion, z, *cat_list)[source]#

The forward computation for a single sample.

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

  2. Returns parameters for the beta-binomial distribution of methylation

  3. If dispersion != 'region-cell' then value for that param will be None

Parameters:
  • dispersion (str) –

    One of the following

    • 'region' - dispersion parameter of NB is constant per region across cells

    • 'region-cell' - dispersion can differ for every region in every cell

  • z (Tensor) – tensor with shape (n_input,)

  • library_size – library size

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

Return type:

tuple[Tensor, Tensor]

Returns:

2-tuple of torch.Tensor parameters for the Beta distribution of mean methylation values