scvi.module.VAEC#
- class scvi.module.VAEC(n_input, n_labels=0, n_hidden=128, n_latent=5, n_layers=2, log_variational=True, ct_weight=None, dropout_rate=0.05, extra_encoder_kwargs=None, extra_decoder_kwargs=None)[source]#
Bases:
BaseModuleClass
Conditional Variational auto-encoder model.
This is an implementation of the CondSCVI model
- Parameters:
n_input (
int
) – Number of input genesn_labels (
int
(default:0
)) – Number of labelsn_hidden (
Tunable_
[int
] (default:128
)) – Number of nodes per hidden layern_latent (
Tunable_
[int
] (default:5
)) – Dimensionality of the latent spacen_layers (
Tunable_
[int
] (default:2
)) – Number of hidden layers used for encoder and decoder NNslog_variational (
bool
(default:True
)) – Log(data+1) prior to encoding for numerical stability. Not normalization.ct_weight (
ndarray
(default:None
)) – Multiplicative weight for cell type specific latent space.dropout_rate (
Tunable_
[float
] (default:0.05
)) – Dropout rate for the encoder and decoder neural network.extra_encoder_kwargs (
Optional
[dict
] (default:None
)) – Keyword arguments passed intoEncoder
.extra_decoder_kwargs (
Optional
[dict
] (default:None
)) – Keyword arguments passed intoFCLayers
.
Attributes table#
Methods table#
|
Runs the generative model. |
|
High level inference method. |
|
Loss computation. |
|
Generate observation samples from the posterior predictive distribution. |
Attributes#
- VAEC.training: bool#
Methods#
- VAEC.inference(x, y, n_samples=1)[source]#
High level inference method.
Runs the inference (encoder) model.
- VAEC.sample(tensors, n_samples=1)[source]#
Generate observation samples from the posterior predictive distribution.
The posterior predictive distribution is written as \(p(\hat{x} \mid x)\).
- Parameters:
tensors – Tensors dict
n_samples (default:
1
) – Number of required samples for each cell
- Return type:
- Returns:
x_new :
torch.Tensor
tensor with shape (n_cells, n_genes, n_samples)