scvi.module.MRDeconv#
- class scvi.module.MRDeconv(n_spots, n_labels, n_batch, n_hidden, n_layers, n_latent, n_genes, decoder_state_dict, px_decoder_state_dict, px_r, per_ct_bias, dropout_decoder, dropout_amortization=0.03, augmentation=True, n_samples_augmentation=2, n_states_per_label=3, eps_v=0.002, mean_vprior=None, var_vprior=None, mp_vprior=None, amortization='both', prior_mode='mog', add_celltypes=1, n_latent_amortization=None, extra_encoder_kwargs=None, extra_decoder_kwargs=None)[source]#
Bases:
EmbeddingModuleMixin,BaseModuleClassModel for multi-resolution deconvolution of spatial transriptomics.
- Parameters:
n_spots (
int) – Number of input spotsn_labels (
int) – Number of cell typesn_hidden (
int) – Number of neurons in the hidden layersn_layers (
int) – Number of layers used in the encoder networksn_latent (
int) – Number of dimensions used in the latent variablesn_genes (
int) – Number of genes used in the decoderpx_r (
tensor) – parameters for the px_r tensor in the CondSCVI modelper_ct_bias (
tensor) – estimates of per cell-type expression bias in the CondSCVI modeldecoder_state_dict (
OrderedDict) – state_dict from the decoder of the CondSCVI modelpx_decoder_state_dict (
OrderedDict) – state_dict from the px_decoder of the CondSCVI modeldropout_decoder (
float) – Dropout rate for the decoder neural network (same dropout as in CondSCVI decoder)dropout_amortization (
float(default:0.03)) – Dropout rate for the amortization neural networkn_samples_augmentation (
int(default:2)) – Number of samples used in the augmentationn_states_per_label (
int(default:3)) – Number of states per cell-type in each spoteps_v (
float(default:0.002)) – Epsilon value for each cell-type proportion used during training.n_states_per_augmented_label – Number of states per cell-type in each spot during augmentation
mean_vprior (
ndarray(default:None)) – Mean parameter for each component in the empirical prior over the latent spacevar_vprior (
ndarray(default:None)) – Diagonal variance parameter for each component in the empirical prior over the latent spacemp_vprior (
ndarray(default:None)) – Mixture proportion in cell type sub-clustering of each component in the empirical prior amortizationprior_mode (
Literal['mog','normal'] (default:'mog')) – Mode of the prior distribution for the latent space. Either “mog” for mixture of gaussians or “normal” for normal distribution.add_celltypes (
int(default:1)) – Number of additional cell types compared to single cell data to add to the modeln_latent_amortization (
int|None(default:None)) – Number of dimensions used in the latent variables for the amortization encoder neural networkextra_encoder_kwargs (
dict|None(default:None)) – Extra keyword arguments passed intoFCLayers.extra_decoder_kwargs (
dict|None(default:None)) – Extra keyword arguments passed intoFCLayers.
Attributes table#
Methods table#
|
Build the deconvolution model for every cell in the minibatch. |
|
Runs the inference (encoder) model. |
|
Compute the loss. |
|
Sample from the posterior. |
Attributes#
- MRDeconv.training: bool#
Methods#
- MRDeconv.generative(z, ind_x, library, batch_index)[source]#
Build the deconvolution model for every cell in the minibatch.
- MRDeconv.inference(x_augmented, batch_index, n_samples=1, prior_sampled=None, ratios_ct_augmentation=None, ratio_augmentation=None)[source]#
Runs the inference (encoder) model.