# `TinySplitMNIST`

### *class* capymoa.ocl.datasets.TinySplitMNIST[[source]](https://github.com/adaptive-machine-learning/CapyMOA/blob/3e255b1/src/capymoa/ocl/datasets/_tiny.py#L16)

Bases: `_BuiltInCIScenario`

A lower resolution and smaller version of the SplitMNIST dataset for testing.

You should use [`SplitMNIST`](capymoa.ocl.datasets.SplitMNIST.md#capymoa.ocl.datasets.SplitMNIST) instead, this dataset is intended for testing
and documentation purposes.

- 16x16 resolution
- 100 training samples per class
- 20 testing samples per class
- 10 classes
- 5 tasks

#### \_\_init_\_(num_tasks: [int](https://docs.python.org/3/builtins/functions.html#int) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, shuffle_tasks: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True, shuffle_data: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True, seed: [int](https://docs.python.org/3/builtins/functions.html#int) = 0, directory: [Path](https://docs.python.org/3/library/pathlib.html#pathlib.Path) | [None](https://docs.python.org/3/builtins/constants.html#None) = None, auto_download: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True, train_transform: [Callable](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable)[[[Any](https://docs.python.org/3/library/typing.html#typing.Any)], [Tensor](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor)] | [None](https://docs.python.org/3/builtins/constants.html#None) = None, test_transform: [Callable](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable)[[[Any](https://docs.python.org/3/library/typing.html#typing.Any)], [Tensor](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor)] | [None](https://docs.python.org/3/builtins/constants.html#None) = None, normalize_features: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, preload_test: [bool](https://docs.python.org/3/builtins/functions.html#bool) = True, preload_train: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False)[[source]](https://github.com/adaptive-machine-learning/CapyMOA/blob/3e255b1/src/capymoa/ocl/datasets/_base.py#L82)

Create a new online continual learning datamodule.

* **Parameters:**
  * **num_tasks** – The number of tasks to partition the dataset into,
    defaults to [`default_task_count`](#capymoa.ocl.datasets.TinySplitMNIST.default_task_count).
  * **shuffle_tasks** – Should the contents and order of the tasks be
    shuffled, defaults to True.
  * **shuffle_data** – Should the training dataset be shuffled.
  * **seed** – Seed for shuffling the tasks, defaults to 0.
  * **directory** – The directory to download the dataset to, defaults to
    [`capymoa.datasets.get_download_dir()`](capymoa.datasets.md#capymoa.datasets.get_download_dir).
  * **auto_download** – Should the dataset be automatically downloaded
    if it does not exist, defaults to True.
  * **train_transform** – A transform to apply to the training dataset,
    defaults to [`default_train_transform`](#capymoa.ocl.datasets.TinySplitMNIST.default_train_transform).
  * **test_transform** – A transform to apply to the test dataset,
    defaults to [`default_test_transform`](#capymoa.ocl.datasets.TinySplitMNIST.default_test_transform).
  * **normalize_features** – Should the features be normalized. This
    normalization step is after all other transformations.
  * **preload_test** – Should the test dataset be preloaded into CPU memory.
    Helps with memory locality and speed, but increases memory usage.
    Preloading the test dataset is recommended since it is small
    and is used multiple times in evaluation.
  * **preload_train** – Should the training dataset be preloaded into CPU memory.
    Helps with memory locality and speed, but increases memory usage.
    Preloading the training dataset is not recommended, since it is large
    and each sample is only seen once in online continual learning.

#### test_loaders(batch_size: [int](https://docs.python.org/3/builtins/functions.html#int), \*\*kwargs: [Any](https://docs.python.org/3/library/typing.html#typing.Any)) → [Sequence](https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence)[[DataLoader](https://docs.pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader)[[tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[Tensor](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor), [Tensor](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor)]]][[source]](https://github.com/adaptive-machine-learning/CapyMOA/blob/3e255b1/src/capymoa/ocl/datasets/_base.py#L258)

Get the training streams for the scenario.

* **Parameters:**
  * **batch_size** – Collects vectors in batches of this size.
  * **kwargs** – Additional keyword arguments to pass to the DataLoader.
* **Returns:**
  A data loader for each task.

#### train_loaders(batch_size: [int](https://docs.python.org/3/builtins/functions.html#int), shuffle: [bool](https://docs.python.org/3/builtins/functions.html#bool) = False, \*\*kwargs: [Any](https://docs.python.org/3/library/typing.html#typing.Any)) → [Sequence](https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence)[[DataLoader](https://docs.pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader)[[tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[Tensor](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor), [Tensor](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor)]]][[source]](https://github.com/adaptive-machine-learning/CapyMOA/blob/3e255b1/src/capymoa/ocl/datasets/_base.py#L227)

Get the training streams for the scenario.

* The order of the tasks is fixed and does not change between iterations.
  The datasets themselves are shuffled in [`__init__()`](#capymoa.ocl.datasets.TinySplitMNIST.__init__) if shuffle_data
  is set to True. This is because the order of data is important in
  online learning since the learner can only see each example once.

* **Parameters:**
  * **batch_size** – Collects vectors in batches of this size.
  * **kwargs** – Additional keyword arguments to pass to the DataLoader.
* **Returns:**
  A data loader for each task.

#### default_task_count *: [int](https://docs.python.org/3/builtins/functions.html#int)* *= 5*

The default number of tasks in the dataset.

#### default_test_transform *: Callable[[Any], Tensor] | [None](https://docs.python.org/3/builtins/constants.html#None)* *= None*

The default transform to apply to the dataset.

#### default_train_transform *: Callable[[Any], Tensor] | [None](https://docs.python.org/3/builtins/constants.html#None)* *= None*

The default transform to apply to the dataset.

#### mean *: Sequence[[float](https://docs.python.org/3/builtins/functions.html#float)] | [None](https://docs.python.org/3/builtins/constants.html#None)* *= (0.1307,)*

The mean of the features in the dataset used for normalization.

#### num_classes *: [int](https://docs.python.org/3/builtins/functions.html#int)* *= 10*

The number of classes in the dataset.

#### schema *: [Schema](capymoa.stream.Schema.md#capymoa.stream.Schema)*

A schema describing the format of the data.

#### shape *: Sequence[[int](https://docs.python.org/3/builtins/functions.html#int)]* *= (1, 16, 16)*

The shape of each input example.

#### std *: Sequence[[float](https://docs.python.org/3/builtins/functions.html#float)] | [None](https://docs.python.org/3/builtins/constants.html#None)* *= (0.3081,)*

The standard deviation of the features in the dataset used for normalization.

#### stream *: [Stream](capymoa.stream.Stream.md#capymoa.stream.Stream)[[LabeledInstance](capymoa.core.LabeledInstance.md#capymoa.core.LabeledInstance)]*

Stream containing each task in sequence.

#### task_mask *: Tensor*

A mask for the output for each task of shape (num_tasks, num_classes)

#### task_schedule *: Sequence[[set](https://docs.python.org/3/builtins/stdtypes.html#set)[[int](https://docs.python.org/3/builtins/functions.html#int)]]*

A sequence of sets containing the classes for each task.

In online continual learning your learner may not have access to this
attribute. It is provided for evaluation and debugging.
