TaskBoundaryAware#

class capymoa.ocl.TaskBoundaryAware[source]#

Bases: ABC

Interface for learners that are aware of the transition between tasks.

Knowing the transition between tasks is required by some algorithms, but is a relaxation of the online continual learning setting. A researcher should be mindful and communicate when a learner is task-aware.

>>> from capymoa.classifier import NoChange
>>> from capymoa.datasets.ocl import TinySplitMNIST
>>> from capymoa.ocl import TaskBoundaryAware
>>> from capymoa.evaluation.ocl import ocl_train_eval_loop
>>> class MyTaskBoundaryAware(TaskBoundaryAware, NoChange):
...     def set_train_task(self, train_task_id: int):
...         print(f"Training task {train_task_id}")
>>> scenario = TinySplitMNIST()
>>> learner = MyTaskBoundaryAware(scenario.schema)
>>> _ = ocl_train_eval_loop(learner, scenario.train_streams, scenario.test_streams)
Training task 0
Training task 1
Training task 2
Training task 3
Training task 4
abstract set_train_task(train_task_id: int)[source]#

Called when a new training task starts.

Parameters:

task_id – The ID of the new task.