scvi.nn.DecoderSCVI#
- class scvi.nn.DecoderSCVI(n_input, n_output, n_cat_list=None, n_layers=1, n_hidden=128, inject_covariates=True, use_batch_norm=False, use_layer_norm=False, scale_activation='softmax', **kwargs)[source]#
Bases:
ModuleDecodes data from a latent space of
n_inputdimensions inton_outputdimensions.Uses a fully-connected neural network of
n_hiddenlayers.- Parameters:
n_input (
int) – The dimensionality of the input (latent space)n_output (
int) – The dimensionality of the output (data space)n_cat_list (
Iterable[int] (default:None)) – A list containing the number of categories for each category of interest. Each category will be included using a one-hot encodingn_layers (
int(default:1)) – The number of fully-connected hidden layersn_hidden (
int(default:128)) – The number of nodes per hidden layerdropout_rate – Dropout rate to apply to each of the hidden layers
inject_covariates (
bool(default:True)) – Whether to inject covariates in each layer, or just the first (default).use_batch_norm (
bool(default:False)) – Whether to use batch norm in layersuse_layer_norm (
bool(default:False)) – Whether to use layer norm in layersscale_activation (
Literal['softmax','softplus'] (default:'softmax')) – Activation layer to use for px_scale_decoder**kwargs – Keyword args for
FCLayers.
Attributes table#
Methods table#
|
The forward computation for a single sample. |
Attributes#
- DecoderSCVI.training: bool#
Methods#
- DecoderSCVI.forward(dispersion, z, library, *cat_list)[source]#
The forward computation for a single sample.
Decodes the data from the latent space using the decoder network
Returns parameters for the ZINB distribution of expression
If
dispersion != 'gene-cell'then the value for that param will beNone
- Parameters:
dispersion (
str) –One of the following
'gene'- dispersion parameter of NB is constant per gene across cells'gene-batch'- dispersion can differ between different batches'gene-label'- dispersion can differ between different labels'gene-cell'- dispersion can differ for every gene in every cell
z (
Tensor) – tensor with shape(n_input,)library (
Tensor) – library sizecat_list (
int) – list of category membership(s) for this sample
- Returns:
4-tuple of
torch.Tensorparameters for the ZINB distribution of expression