univi.data.MultiModalDataset#
- class univi.data.MultiModalDataset(*args, **kwargs)[source]#
Bases:
DatasetTorch dataset over one AnnData per modality.
Each item is
x_dict(modality name -> 1D float tensor), optionally followed by labels and/or reconstruction targets:x_dict(x_dict, y)whenlabelsis given (yis a scalar tensor, or a dict of scalar tensors keyed by head name for multi-head labels)(x_dict, recon_targets)whenrecon_targets_specis given, whererecon_targets[mod] = {"successes": ..., "total_count": ...}(x_dict, y, recon_targets)when both are given
Use
univi.data.collate_multimodal_xy_recon()(orunivi.workflows.make_loader()) to batch items.- Parameters:
adata_dict –
{modality: AnnData}. Withpaired=Trueall objects must have identical, identically orderedobs_names.layer – Layer to read per modality (
Nonereads.X); a string or a dict.X_key –
"X"or an.obsmkey per modality; a string or a dict.labels – Integer labels, or a dict of label arrays keyed by head name.
modality_cfgs – Optional
ModalityConfiglist, used for categorical modalities read from.obs(input_kind="obs").recon_targets_spec –
{modality: {"successes_layer": ..., "total_count_layer": ...}}for binomial / beta-binomial likelihoods.
- __init__(adata_dict, layer=None, X_key='X', paired=True, device=None, labels=None, dtype=torch.float32, modality_cfgs=None, recon_targets_spec=None)[source]#
Methods
__init__(adata_dict[, layer, X_key, paired, ...])Attributes
n_cellsobs_names