Skip to content

Adding the option of mixing current data with historic data for CL - #107

Merged
krm9c merged 4 commits into
mainfrom
historic_mix
Jul 26, 2026
Merged

Adding the option of mixing current data with historic data for CL#107
krm9c merged 4 commits into
mainfrom
historic_mix

Conversation

@anagainaru

@anagainaru anagainaru commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adding logic to mix historic and current data for updaters that fallback to the fwd_bwd function in the base updater. The current solution concatenates half of the training bath with half of the historic batch and uses this mix as the training loader. How much of the history is kept in the historic data loaders is defined in the model harness. The MNIST example keeps everything but others could keep only the last few windows.

New option for the configuration file:

mix_historic_data = true

Changing the MNIST example to keep track of the entire history instead of just the last window to illustrate the benefit of using history for doing continual learning.

Screenshot 2026-07-22 at 9 51 21 AM
  • Yellow line is obtained using:
pretrained_path = "examples/mnist/mnist.pth"
[drift_detection]
detection_interval = 0
  • Blue line is using the model saved at the end of running Apeiron on the default model with Base CL and ADWin drift detector and mix_historic_data = false.

  • Green line is using the model saved at the end of running Apeiron on the default model with Base CL and ADWin drift detector and mix_historic_data = true.

Changes to the MNIST example: see below why is needed

@anagainaru
anagainaru requested a review from krm9c July 21, 2026 13:59
@anagainaru anagainaru added the enhancement New feature or request label Jul 21, 2026
@anagainaru anagainaru changed the title Historic mix Adding the option of mixing current data with historic data for CL Jul 22, 2026

@krm9c krm9c left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, I am only confused about the following lines

TransformedView(self.ds_val, x_transform=FixedAffine(self.aug_history[:-1]))
TransformedView(self.ds_val, x_transform=FixedAffine(self.aug_history[:i]))
for i in range(1, len(self.aug_history))

Otherwise the results make sense.

@anagainaru

anagainaru commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator Author

I think, I am only confused about the following lines

TransformedView(self.ds_val, x_transform=FixedAffine(self.aug_history[:-1])) TransformedView(self.ds_val, x_transform=FixedAffine(self.aug_history[:i])) for i in range(1, len(self.aug_history))

Otherwise the results make sense.

TransformedView(self.ds_train, x_transform=FixedAffine(self.aug_history[:-1]))

FixedAffine applies all the transforms in the list in sequence. With [:-1] (every drift except the current), the history is rendered exactly like the previous window — one snapshot, not the full past.

With the change:

FixedAffine(self.aug_history[:i]) for i in range(1, len(self.aug_history))

One view per past transform sequence we keep in the history, the same dataset at every rotation we've seen before.

With [:-1], replay only showed the previous regime, so the model kept converging toward the latest images instead of retaining all past rotations.

@krm9c
krm9c merged commit f3184b9 into main Jul 26, 2026
3 checks passed
@anagainaru

Copy link
Copy Markdown
Collaborator Author

Next time please approve and do not merge

@krm9c

krm9c commented Jul 26, 2026 via email

Copy link
Copy Markdown
Collaborator

@anagainaru
anagainaru deleted the historic_mix branch July 27, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants