spVIPES.dataloaders._ann_dataloader.AnnDataLoader#
- class spVIPES.dataloaders._ann_dataloader.AnnDataLoader#
Bases:
DataLoaderDataLoader for loading tensors from AnnData objects.
- Parameters:
adata_manager (
AnnDataManager) –AnnDataManagerobject with a registered AnnData object.shuffle (
bool(default:False)) – Whether the data should be shuffleduse_labels (
bool(default:False)) – Whether to use labels for weighted samplingindices (
Union[Sequence[int],Sequence[bool],None] (default:None)) – The indices of the observations in the adata to loadbatch_size (
int(default:128)) – minibatch size to load each iterationsampler (
Optional[Sampler] (default:None)) – Defines the strategy to draw samples from the dataset. Can be any Iterable with __len__ implemented. If specified, shuffle must not be specified. By default, we use a custom sampler that is designed to get a minibatch of data with one call to __getitem__.data_and_attributes (
Union[list[str],dict[str,dtype],None] (default:None)) – Dictionary with keys representing keys in data registry (adata_manager.data_registry) and value equal to desired numpy loading type (later made into torch tensor) or list of such keys. A list can be used to subset to certain keys in the event that more tensors than needed have been registered. IfNone, defaults to all registered data.iter_ndarray (
bool(default:False)) – Whether to iterate over numpy arrays instead of torch tensorsdata_loader_kwargs – Keyword arguments for
DataLoader
- __init__(adata_manager, shuffle=False, use_labels=False, indices=None, batch_size=128, sampler=None, data_and_attributes=None, drop_last=False, iter_ndarray=False, **data_loader_kwargs)#