scvi.module.PEAKVAE#

class scvi.module.PEAKVAE(n_input_regions, n_batch=0, n_hidden=None, n_latent=None, n_layers_encoder=2, n_layers_decoder=2, n_continuous_cov=0, n_cats_per_cov=None, dropout_rate=0.1, model_depth=True, region_factors=True, use_batch_norm='none', use_layer_norm='both', latent_distribution='normal', deeply_inject_covariates=False, encode_covariates=False, extra_encoder_kwargs=None, extra_decoder_kwargs=None)[source]#

Bases: BaseModuleClass

Variational auto-encoder model for ATAC-seq data.

This is an implementation of the peakVI model descibed in.

Parameters:
  • n_input_regions (int) – Number of input regions.

  • n_batch (int (default: 0)) – Number of batches, if 0, no batch correction is performed.

  • n_hidden (Tunable_[int] (default: None)) – Number of nodes per hidden layer. If None, defaults to square root of number of regions.

  • n_latent (Tunable_[int] (default: None)) – Dimensionality of the latent space. If None, defaults to square root of n_hidden.

  • n_layers_encoder (Tunable_[int] (default: 2)) – Number of hidden layers used for encoder NN.

  • n_layers_decoder (Tunable_[int] (default: 2)) – Number of hidden layers used for decoder NN.

  • dropout_rate (Tunable_[float] (default: 0.1)) – Dropout rate for neural networks

  • model_depth (bool (default: True)) – Model library size factors or not.

  • region_factors (bool (default: True)) – Include region-specific factors in the model

  • use_batch_norm (Tunable_[Literal['encoder', 'decoder', 'none', 'both']] (default: 'none')) –

    One of the following

    • 'encoder' - use batch normalization in the encoder only

    • 'decoder' - use batch normalization in the decoder only

    • 'none' - do not use batch normalization (default)

    • 'both' - use batch normalization in both the encoder and decoder

  • use_layer_norm (Tunable_[Literal['encoder', 'decoder', 'none', 'both']] (default: 'both')) –

    One of the following

    • 'encoder' - use layer normalization in the encoder only

    • 'decoder' - use layer normalization in the decoder only

    • 'none' - do not use layer normalization

    • 'both' - use layer normalization in both the encoder and decoder (default)

  • latent_distribution (Tunable_[Literal['normal', 'ln']] (default: 'normal')) –

    which latent distribution to use, options are

    • 'normal' - Normal distribution (default)

    • 'ln' - Logistic normal distribution (Normal(0, I) transformed by softmax)

  • deeply_inject_covariates (Tunable_[bool] (default: False)) – Whether to deeply inject covariates into all layers of the decoder. If False (default), covairates will only be included in the input layer.

  • encode_covariates (bool (default: False)) – Whether to concatenate covariates to expression in encoder.

  • extra_encoder_kwargs (Optional[dict] (default: None)) – Extra keyword arguments passed into scvi.nn.Encoder.

  • extra_decoder_kwargs (Optional[dict] (default: None)) – Extra keyword arguments passed into scvi.nn.Decoder.

Attributes table#

training

Methods table#

generative(z, qz_m, batch_index[, ...])

Runs the generative model.

get_reconstruction_loss(p, d, f, x)

Compute the reconstruction loss.

inference(x, batch_index, cont_covs, cat_covs)

Helper function used in forward pass.

loss(tensors, inference_outputs, ...[, ...])

Compute the loss.

Attributes#

PEAKVAE.training: bool#

Methods#

PEAKVAE.generative(z, qz_m, batch_index, cont_covs=None, cat_covs=None, use_z_mean=False)[source]#

Runs the generative model.

PEAKVAE.get_reconstruction_loss(p, d, f, x)[source]#

Compute the reconstruction loss.

PEAKVAE.inference(x, batch_index, cont_covs, cat_covs, n_samples=1)[source]#

Helper function used in forward pass.

Return type:

dict[str, Tensor]

PEAKVAE.loss(tensors, inference_outputs, generative_outputs, kl_weight=1.0)[source]#

Compute the loss.