nichecompass.modules.compute_gp_l1_reg_loss

nichecompass.modules.compute_gp_l1_reg_loss(model, gp_type, l1_targets_mask=None, l1_sources_mask=None)

Compute L1 regularization loss for the rna decoder weights of gene programs of the type ´gp_type´ to encourage gene sparsity of those gene programs.

Parameters:
  • model (Module) – The VGPGAE module.

  • gp_type (Literal['prior', 'addon']) – Type of gene programs to which the L1 regularization loss should be applied.

  • l1_targets_mask (Optional[Tensor] (default: None)) – Boolean gene program gene mask that is True for all gene program target genes to which the L1 regularization loss should be applied (dim: n_genes, n_gps).

  • l1_sources_mask (Optional[Tensor] (default: None)) – Boolean gene program gene mask that is True for all gene program source genes to which the L1 regularization loss should be applied (dim: n_genes, n_gps).

Return type:

Tensor

Returns:

gp_l1_reg_loss: L1 regularization loss for the rna decoder weights.