scvi.module.MRDeconv

class scvi.module.MRDeconv(n_spots, n_labels, n_hidden, n_layers, n_latent, n_genes, decoder_state_dict, px_decoder_state_dict, px_r, mean_vprior=None, var_vprior=None, amortization='latent')[source]

Bases: scvi.module.base._base_module.BaseModuleClass

Model for multi-resolution deconvolution of spatial transriptomics.

Parameters
n_spots : intint

Number of input spots

n_labels : intint

Number of cell types

n_hidden : intint

Number of neurons in the hidden layers

n_layers : intint

Number of layers used in the encoder networks

n_latent : intint

Number of dimensions used in the latent variables

n_genes : intint

Number of genes used in the decoder

decoder_state_dict : OrderedDictOrderedDict

state_dict from the decoder of the CondSCVI model

px_decoder_state_dict : OrderedDictOrderedDict

state_dict from the px_decoder of the CondSCVI model

px_r : ndarrayndarray

parameters for the px_r tensor in the CondSCVI model

mean_vprior : ndarray | NoneOptional[ndarray] (default: None)

Mean parameter for each component in the empirical prior over the latent space

var_vprior : ndarray | NoneOptional[ndarray] (default: None)

Diagonal variance parameter for each component in the empirical prior over the latent space

amortization : {‘none’, ‘latent’, ‘proportion’, ‘both’}Literal[‘none’, ‘latent’, ‘proportion’, ‘both’] (default: 'latent')

which of the latent variables to amortize inference over (gamma, proportions, both or none)

Attributes

Methods

generative(x, ind_x)

Build the deconvolution model for every cell in the minibatch.

get_ct_specific_expression([x, ind_x, y])

Returns cell type specific gene expression at the queried spots.

get_gamma([x])

Returns the loadings.

get_proportions([x, keep_noise])

Returns the loadings.

inference()

Run the inference (recognition) model.

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

Compute the loss for a minibatch of data.

sample(tensors[, n_samples, library_size])

Generate samples from the learned model.