smoother.models.reduction._spmultivi ==================================== .. py:module:: smoother.models.reduction._spmultivi Classes ------- .. autoapisummary:: smoother.models.reduction._spmultivi.SPMULTIVAE smoother.models.reduction._spmultivi.SpatialMULTIVI Functions --------- .. autoapisummary:: smoother.models.reduction._spmultivi.get_reconstruction_loss_protein Module Contents --------------- .. py:function:: get_reconstruction_loss_protein(y, py_, pro_batch_mask_minibatch=None) Get the reconstruction loss for protein data. .. py:class:: SPMULTIVAE(spatial_loss: Optional[smoother.SpatialLoss] = None, lambda_spatial_loss: float = 1, sp_loss_as_kl: bool = True, **model_kwargs) Bases: :py:obj:`scvi.module.MULTIVAE` Add spatial loss to the latent representation in the MULTIVAE model. :param spatial_loss: Spatial loss to apply on the latent representation. If None, no spatial loss. :param lambda_spatial_loss: Weight of the spatial loss. :param sp_loss_as_kl: Whether to apply the spatial loss as a KL term (i.e. replacing the original Normal(0, 1) prior) or as a separate global term. .. py:attribute:: spatial_loss :value: None .. py:attribute:: l_sp_loss :value: 1 .. py:attribute:: sp_loss_as_kl :value: True .. py:attribute:: diag_sp_inv_cov :value: None .. py:method:: loss(tensors, inference_outputs, generative_outputs, kl_weight: float = 1.0) -> scvi.module.base.LossOutput Computes the loss function for the model. .. py:method:: from_vae(vae_module: scvi.module.MULTIVAE, spatial_loss: Optional[smoother.SpatialLoss] = None, lambda_spatial_loss: float = 1, sp_loss_as_kl: bool = True) :classmethod: .. py:class:: SpatialMULTIVI(st_adata: anndata.AnnData, spatial_loss: Optional[smoother.SpatialLoss] = None, lambda_spatial_loss: float = 1, sp_loss_as_kl: bool = True, **model_kwargs) Bases: :py:obj:`scvi.model.MULTIVI` Spatially-aware Multimodal Variational Autoencoder model. .. py:attribute:: _data_splitter_cls .. py:attribute:: _module_cls .. py:attribute:: module .. py:attribute:: _model_summary_string .. py:attribute:: init_params_ .. py:attribute:: dr_logs .. py:method:: train(max_epochs: int = 500, lr: float = 0.0001, accelerator: str = 'auto', devices='auto', weight_decay: float = 0.001, eps: float = 1e-08, n_steps_kl_warmup=None, n_epochs_kl_warmup=50, adversarial_mixing=False, datasplitter_kwargs=None, plan_kwargs=None, **kwargs) Train the model without mini-batch. .. py:method:: from_sc_model(st_adata: mudata.MuData, sc_model: scvi.model.MULTIVI, spatial_loss: Optional[smoother.SpatialLoss] = None, lambda_spatial_loss: float = 1, sp_loss_as_kl: bool = True, unfrozen: bool = False, freeze_dropout: bool = False, freeze_expression: bool = True, freeze_decoder_first_layer: bool = True, freeze_batchnorm_encoder: bool = True, freeze_batchnorm_decoder: bool = False, freeze_classifier: bool = True, **spmultivae_kwargs) :classmethod: Alternate constructor for exploiting a pre-trained model on non-spatial data. Note that because of the dropout layer, even though the new instance is initialized with the same parameters as the pre-trained model, new_instance.get_latent_representation() may not return the same latent representation as the pre-trained model. :param st_adata: registed anndata object :param sc_model: pretrained MULTIVI model