scvi.dataloaders.AnnbatchDataModule#
- class scvi.dataloaders.AnnbatchDataModule(dataset, batch_size=None, batch_key=None, label_key=None, sample_key=None, unlabeled_category='Unknown', model_name='SCVI', train_size=1.0, categorical_covariate_keys=None, continuous_covariate_keys=None, var_names=None, layer=None, chunk_size=256, preload_nchunks=32, preload_to_gpu=True, shuffle=False, class_sampler_key=None, class_weights=None)[source]#
Bases:
LightningDataModuleLightningDataModule for annbatch.Loader with full scvi-tools integration.
- Parameters:
dataset (annbatch.Loader) – The Loader configured with a DatasetCollection.
batch_size (int, optional) – Not used directly — the Loader already handles batching internally.
batch_key (str, optional) – Column name in obs to use as batch identity.
label_key (str, optional) – Column name in obs to use as labels.
sample_key (str, optional) – Column name in obs to use as sample identity.
unlabeled_category (str, optional) – Value used for unlabeled cells. Default is
"Unknown".model_name (str, optional) – The scvi-tools model name. Default is
"SCVI".train_size (float, optional) – Fraction of data to use for training. Default is
1.0.categorical_covariate_keys (list of str, optional) – Column names in obs to use as categorical covariates.
continuous_covariate_keys (list of str, optional) – Column names in obs to use as continuous covariates.
Attributes table#
Fraction of data to use for training. |
|
String assigned to unlabeled cells. |
Methods table#
Dataloader for inference with |
|
|
Convert an annbatch Loader batch to the dictionary required by scvi-tools. |
|
Update the annbatch sampler batch size used for train and validation. |
|
Configure disjoint train/validation ranges over the same annbatch collection. |
Create the train data loader. |
|
Create the validation data loader. |
Attributes#
Methods#
- AnnbatchDataModule.inference_dataloader()[source]#
Dataloader for inference with
on_before_batch_transferapplied.
- AnnbatchDataModule.on_before_batch_transfer(batch, dataloader_idx)[source]#
Convert an annbatch Loader batch to the dictionary required by scvi-tools.
Follows the same encoding pattern as
TileDBDataModuleandMappedCollectionDataModule.
- AnnbatchDataModule.set_batch_size(batch_size=None)[source]#
Update the annbatch sampler batch size used for train and validation.
- Return type: