scvi.external.stereoscope.RNADeconv#
- class scvi.external.stereoscope.RNADeconv(n_genes, n_labels, **model_kwargs)[source]#
Bases:
scvi.module.base._base_module.BaseModuleClass
Model of single-cell RNA-sequencing data for deconvolution of spatial transriptomics.
Reimplementation of the ScModel module of Stereoscope [Andersson20]: https://github.com/almaan/stereoscope/blob/master/stsc/models.py.
Attributes table#
Methods table#
|
Simply build the negative binomial parameters for every cell in the minibatch. |
Returns the parameters for feeding into the spatial data. |
|
Run the inference (recognition) model. |
|
|
Compute the loss for a minibatch of data. |
|
Generate samples from the learned model. |
Attributes#
T_destination#
- RNADeconv.T_destination#
alias of TypeVar(‘T_destination’, bound=
Mapping
[str
,torch.Tensor
])
alias of TypeVar(‘T_destination’, bound=Mapping
[str
, torch.Tensor
])
.. autoattribute:: RNADeconv.T_destination
device
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- RNADeconv.device#
dump_patches#
- RNADeconv.dump_patches: bool = False#
This allows better BC support for
load_state_dict()
. Instate_dict()
, the version number will be saved as in the attribute _metadata of the returned state dict, and thus pickled. _metadata is a dictionary with keys that follow the naming convention of state dict. See_load_from_state_dict
on how to use this information in loading.If new parameters/buffers are added/removed from a module, this number shall be bumped, and the module’s _load_from_state_dict method can compare the version number and do appropriate changes if the state dict is from before the change.
training#
Methods#
generative#
get_params#
inference#
- RNADeconv.inference()[source]#
Run the inference (recognition) model.
In the case of variational inference, this function will perform steps related to computing variational distribution parameters. In a VAE, this will involve running data through encoder networks.
This function should return a dictionary with str keys and
Tensor
values.
loss#
- RNADeconv.loss(tensors, inference_outputs, generative_outputs, kl_weight=1.0)[source]#
Compute the loss for a minibatch of data.
This function uses the outputs of the inference and generative functions to compute a loss. This many optionally include other penalty terms, which should be computed here.
This function should return an object of type
LossRecorder
.