scvi.model.base.ArchesMixin#
Methods table#
|
Online update of a reference model with scArches algorithm [Lotfollahi et al., 2021]. |
|
Prepare data for query integration. |
Methods#
load_query_data
- classmethod ArchesMixin.load_query_data(adata, reference_model, inplace_subset_query_vars=False, use_gpu=None, unfrozen=False, freeze_dropout=False, freeze_expression=True, freeze_decoder_first_layer=True, freeze_batchnorm_encoder=True, freeze_batchnorm_decoder=False, freeze_classifier=True)[source]#
Online update of a reference model with scArches algorithm [Lotfollahi et al., 2021].
- Parameters:
adata (AnnData) – AnnData organized in the same way as data used to train model. It is not necessary to run setup_anndata, as AnnData is validated against the
registry
.reference_model (Union[str, BaseModelClass]) – Either an already instantiated model of the same class, or a path to saved outputs for reference model.
inplace_subset_query_vars (bool) – Whether to subset and rearrange query vars inplace based on vars used to train reference model.
use_gpu (Optional[Union[str, int, bool]]) – Load model on default GPU if available (if None or True), or index of GPU to use (if int), or name of GPU (if str), or use CPU (if False).
unfrozen (bool) – Override all other freeze options for a fully unfrozen model
freeze_dropout (bool) – Whether to freeze dropout during training
freeze_expression (bool) – Freeze neurons corersponding to expression in first layer
freeze_decoder_first_layer (bool) – Freeze neurons corersponding to first layer in decoder
freeze_batchnorm_encoder (bool) – Whether to freeze batchnorm weight and bias during training for encoder
freeze_batchnorm_decoder (bool) – Whether to freeze batchnorm weight and bias during training for decoder
freeze_classifier (bool) – Whether to freeze classifier completely. Only applies to
SCANVI
.
prepare_query_anndata
- static ArchesMixin.prepare_query_anndata(adata, reference_model, return_reference_var_names=False, inplace=True)[source]#
Prepare data for query integration.
This function will return a new AnnData object with padded zeros for missing features, as well as correctly sorted features.
- Parameters:
adata (AnnData) – AnnData organized in the same way as data used to train model. It is not necessary to run setup_anndata, as AnnData is validated against the
registry
.reference_model (Union[str, BaseModelClass]) – Either an already instantiated model of the same class, or a path to saved outputs for reference model.
return_reference_var_names (bool) – Only load and return reference var names if True.
inplace (bool) – Whether to subset and rearrange query vars inplace or return new AnnData.
- Returns:
Query adata ready to use in
load_query_data
unlessreturn_reference_var_names
in which case a pd.Index of reference var names is returned.- Return type: