# scvi.model.base.VAEMixin#

class scvi.model.base.VAEMixin[source]#

Univseral VAE methods.

## Methods table#

 get_elbo([adata, indices, batch_size]) Return the ELBO for the data. get_latent_representation([adata, indices, ...]) Return the latent representation for each cell. get_marginal_ll([adata, indices, ...]) Return the marginal LL for the data. get_reconstruction_error([adata, indices, ...]) Return the reconstruction error for the data.

## Methods#

get_elbo

Return the ELBO for the data.

The ELBO is a lower bound on the log likelihood of the data used for optimization of VAEs. Note, this is not the negative ELBO, higher is better.

Parameters:
Return type:

float

get_latent_representation

VAEMixin.get_latent_representation(adata=None, indices=None, give_mean=True, mc_samples=5000, batch_size=None, return_dist=False)[source]#

Return the latent representation for each cell.

This is denoted as $$z_n$$ in our manuscripts.

Parameters:
• adata (Optional[AnnData] (default: None)) – AnnData object with equivalent structure to initial AnnData. If None, defaults to the AnnData object used to initialize the model.

• indices (Optional[Sequence[int]] (default: None)) – Indices of cells in adata to use. If None, all cells are used.

• give_mean (bool (default: True)) – Give mean of distribution or sample from it.

• mc_samples (int (default: 5000)) – For distributions with no closed-form mean (e.g., logistic normal), how many Monte Carlo samples to take for computing mean.

• batch_size (Optional[int] (default: None)) – Minibatch size for data loading into model. Defaults to scvi.settings.batch_size.

• return_dist (bool (default: False)) – Return the distribution parameters of the latent variables rather than their sampled values. If True, ignores give_mean and mc_samples.

Return type:
Returns:

Low-dimensional representation for each cell or a tuple containing its mean and variance.

get_marginal_ll

Return the marginal LL for the data.

The computation here is a biased estimator of the marginal log likelihood of the data. Note, this is not the negative log likelihood, higher is better.

Parameters:
Return type:

float

get_reconstruction_error

This is typically written as $$p(x \mid z)$$, the likelihood term given one posterior sample. Note, this is not the negative likelihood, higher is better.
float