scvi.dataloaders.SemiSupervisedDataLoader

class scvi.dataloaders.SemiSupervisedDataLoader(adata, unlabeled_category, n_samples_per_label=None, indices=None, shuffle=False, batch_size=128, data_and_attributes=None, drop_last=False, **data_loader_kwargs)[source]

DataLoader that supports semisupervised training.

Parameters
adata : AnnDataAnnData

AnnData object that have been registered via setup_anndata().

unlabeled_category : strstr

Category to treat as unlabeled

n_samples_per_label : int | NoneOptional[int] (default: None)

Number of subsamples for each label class to sample per epoch. By default, there is no label subsampling.

indices : List[int] | NoneOptional[List[int]] (default: None)

The indices of the observations in the adata to load

shuffle : boolbool (default: False)

Whether the data should be shuffled

batch_size : Optional[int]

minibatch size to load each iteration

data_and_attributes : dict | NoneOptional[dict] (default: None)

Dictionary with keys representing keys in data registry (adata.uns[“_scvi”]) and value equal to desired numpy loading type (later made into torch tensor). If None, defaults to all registered data.

data_loader_kwargs

Keyword arguments for DataLoader

Attributes

multiprocessing_context

Methods

check_worker_number_rationality()

resample_labels()

Resamples the labeled data.

subsample_labels()

Subsamples each label class by taking up to n_samples_per_label samples per class.