MultiDataset#

class bayesflow.experimental.MultiDataset(**datasets)[source]#

Bases: PyDataset

A dataset that combines multiple named datasets into a single batch.

On each step, one batch is drawn from every constituent dataset and returned together as {"name1": batch1, "name2": batch2, ...}. This format matches what SemiSupervisedEstimator.compute_metrics expects.

When datasets have different lengths (num_batches), shorter datasets are recycled (modulo indexing), so training always runs for max(num_batches) steps.

Parameters:
**datasetskeras.utils.PyDataset

Named datasets to combine. Pass as keyword arguments, e.g. MultiDataset(labeled=ds1, unlabeled=ds2).

property num_batches: int#

Total number of steps per epoch — the maximum across all constituent datasets.

property dataset_keys: Sequence[str]#

Names of the constituent datasets.

get_config() → dict[source]#
classmethod from_config(config: dict) → MultiDataset[source]#
property max_queue_size#
on_epoch_begin()#

Method called at the beginning of every epoch.

on_epoch_end()#

Method called at the end of every epoch.

property use_multiprocessing#
property workers#