mypackage.MyModel.get_latent_representation

MyModel.get_latent_representation(adata=None, indices=None, give_mean=True, mc_samples=5000, batch_size=None)

Return the latent representation for each cell.

This is denoted as \(z_n\) in our manuscripts.

Parameters
adata : AnnData | NoneOptional[AnnData] (default: None)

AnnData object with equivalent structure to initial AnnData. If None, defaults to the AnnData object used to initialize the model.

indices : Sequence[int] | NoneOptional[Sequence[int]] (default: None)

Indices of cells in adata to use. If None, all cells are used.

give_mean : boolbool (default: True)

Give mean of distribution or sample from it.

mc_samples : intint (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 : int | NoneOptional[int] (default: None)

Minibatch size for data loading into model. Defaults to scvi.settings.batch_size.

Return type

ndarrayndarray

Returns

-latent_representation (ndarray) Low-dimensional representation for each cell