nichecompass.nn.MaskedOmicsFeatureDecoder
- class nichecompass.nn.MaskedOmicsFeatureDecoder(modality, entity, n_prior_gp_input, n_addon_gp_input, n_cat_covariates_embed_input, n_output, mask, addon_mask, masked_features_idx, recon_loss)
Masked omics feature decoder class.
Takes the latent space features z (gp scores) as input, and has a masked layer to decode the parameters of the underlying omics feature distributions.
- Parameters:
modality (
Literal['rna','atac']) – Omics modality that is decoded. Can be eitherrnaoratac.entity (
Literal['target','source']) – Entity that is decoded. Can be eithertargetorsource.n_prior_gp_input (
int) – Number of maskable prior gp input nodes to the decoder (maskable latent space dimensionality).n_addon_gp_input (
int) – Number of non-maskable add-on gp input nodes to the decoder ( non-maskable latent space dimensionality).n_cat_covariates_embed_input (
int) – Number of categorical covariates embedding input nodes to the decoder (categorical covariates embedding dimensionality).n_output (
int) – Number of output nodes from the decoder (number of omics features).mask (
Tensor) – Mask that determines which masked input nodes / prior gp latent features z can contribute to the reconstruction of which omics features.addon_mask (
Tensor) – Mask that determines which add-on input nodes / add-on gp latent features z can contribute to the reconstruction of which omics features.masked_features_idx (
List) – Index of omics features that are included in the mask.recon_loss (
Literal['nb']) – The loss used for omics reconstruction. Ifnb, uses a negative binomial loss.
Methods table
|
Forward pass of the masked omics feature decoder. |
Methods
- MaskedOmicsFeatureDecoder.forward(z, log_library_size, cat_covariates_embed=None, dynamic_mask=None)
Forward pass of the masked omics feature decoder.
- Parameters:
z (
Tensor) – Tensor containing the latent space features.log_library_size (
Tensor) – Tensor containing the omics feature log library size of the nodes.dynamic_mask (
Optional[Tensor] (default:None)) – Dynamic mask that can change in each forward pass. Is used for atac modality: if a gene is removed by regularization in the rna decoder (its weight is set to 0), the corresponding peaks will be marked as 0 in thedynamic_mask.cat_covariates_embed (
Optional[Tensor] (default:None)) – Tensor containing the categorical covariates embedding (all categorical covariates embeddings concatenated into one embedding).
- Return type:
Tensor- Returns:
nb_means: The mean parameters of the negative binomial distribution.