avalanche.benchmarks.new_instances_benchmark(train_dataset: ClassificationDataset, test_dataset: AvalancheDataset, num_experiences: int, *, shuffle: bool = True, seed: int | None = None, balance_experiences: bool = False, min_class_patterns_in_exp: int = 0) CLScenario[source]

Benchmark generator for “New Instances” (NI) scenarios.

Given a train_dataset and a `test_dataset, the generator creates a benchmark where the training stream is split according to the New Instances setting.

Notice that we don’t split the test dataset in this generator because we have random splits, so it is more natural to test on the full test set at each step instead of an i.i.d. random test split.

  • train_dataset – An AvalancheDataset used to define the training stream.

  • test_dataset – A test AvalancheDataset. This will not be split.

  • num_experiences – The desired stream length.

  • shuffle – If True, patterns order will be shuffled.

  • seed – A valid int used to initialize the random number generator. Can be None.

  • balance_experiences – If True, pattern of each class will be equally spread across all experiences. If False, patterns will be assigned to experiences in a complete random way. Defaults to False.

  • min_class_patterns_in_exp – The minimum amount of patterns of every class that must be assigned to every experience. Compatible with the balance_experiences parameter. An exception will be raised if this constraint can’t be satisfied. Defaults to 0.


A properly initialized NIScenario instance.