class scvi.external.velovi.VELOVAE(n_input, true_time_switch=None, n_hidden=128, n_latent=10, n_layers=1, dropout_rate=0.1, log_variational=False, latent_distribution='normal', use_batch_norm='both', use_layer_norm='both', use_observed_lib_size=True, var_activation=Softplus(beta=1.0, threshold=20.0), model_steady_states=True, gamma_unconstr_init=None, alpha_unconstr_init=None, alpha_1_unconstr_init=None, lambda_alpha_unconstr_init=None, switch_spliced=None, switch_unspliced=None, t_max=20, penalty_scale=0.2, dirichlet_concentration=0.25, linear_decoder=False, time_dep_transcription_rate=False)[source]#

Bases: BaseModuleClass

Variational auto-encoder model.

This is an implementation of the veloVI model descibed in [Gayoso et al., 2023].

  • n_input (int) – Number of input genes.

  • n_hidden (int (default: 128)) – Number of nodes per hidden layer.

  • n_latent (int (default: 10)) – Dimensionality of the latent space.

  • n_layers (int (default: 1)) – Number of hidden layers used for encoder and decoder NNs.

  • dropout_rate (float (default: 0.1)) – Dropout rate for neural networks.

  • log_variational (bool (default: False)) – Log(data+1) prior to encoding for numerical stability. Not normalization.

  • latent_distribution (str (default: 'normal')) –

    One of the following:

    • "normal" - Isotropic normal.

    • "ln" - Logistic normal with normal params N(0, 1).

  • use_layer_norm (Literal[‘encoder’, ‘decoder’, ‘none’, ‘both’] (default: 'both')) – Whether to use layer norm in layers.

  • use_observed_lib_size (bool (default: True)) – Use observed library size for RNA as scaling factor in mean of conditional distribution.

  • var_activation (callable | None (default: Softplus(beta=1.0, threshold=20.0))) – Callable used to ensure positivity of the variational distributions’ variance. When None, defaults to exp().

Attributes table#


Methods table#

generative(z, gamma, beta, alpha, alpha_1, ...)

Runs the generative model.


Extract per-gene weights in the linear decoder.

get_px(px_pi, px_rho, px_tau, scale, gamma, ...)



inference(spliced, unspliced[, n_samples])

High level inference method.

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

Compute the loss for a minibatch of data.


Not implemented.

Attributes# bool#


VELOVAE.generative(z, gamma, beta, alpha, alpha_1, lambda_alpha, latent_dim=None)[source]#

Runs the generative model.


Extract per-gene weights in the linear decoder.

Return type:


VELOVAE.get_px(px_pi, px_rho, px_tau, scale, gamma, beta, alpha, alpha_1, lambda_alpha)[source]#
Return type:


VELOVAE.inference(spliced, unspliced, n_samples=1)[source]#

High level inference method.

Runs the inference (encoder) model.

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

Compute the loss for a minibatch of data.

This function uses the outputs of the inference and generative functions to compute a loss. This many optionally include other penalty terms, which should be computed here.

This function should return an object of type LossOutput.


Not implemented.

Return type: