This repository accompanies the publication [Compression-based kNN for Class Incremental Continual Learning](TODO add link)
To preprocess the data, you need python 3.12 with the dependencies listed in requirements_preprocessing.txt.
To run the experiments, you need python 3.7 with the dependencies listed in the requirements_experiments.txt. Additionally, you need to slightly modify the SAM-kNN implementation from scikit-multiflow in order to disable the cleaning step. Sadly, this is not possible without modifying the library code. To disable the cleaning step, in the file skmultiflow/lazy/sam_knn.py add return samplesCl, labelsCl after line 231, such that the clean_samples function cleans no samples:
def clean_samples(self, samplesCl, labelsCl, onlyLast=False):
return samplesCl, labelsCl
[...]
In order to run the experiments, you need to download two datasets. Download both and place them in the data directory. The datasets required are:
- CIFAR-100 python version (https://www.cs.toronto.edu/~kriz/cifar.html)
- Tinyimagenet (https://www.kaggle.com/datasets/akash2sharma/tiny-imagenet)
To preprocess the data for our experiments, run the generateEmbeddings.ipynb notebook. This will generate additional files in the data directory.
To run the experiments, run the runExperimentSAMkNN.ipynb, runExperimentSAMkNN_balanced.ipynb and runExperimentCompressionKNN.ipynb notebooks. For each experiment, the task size can be changed by editing the TASK_SIZE constant at the top of each notebook. For the compression kNN experiment, additionally the number of samples per class can be configured.
Each notebook will save results to disk in a corresponding results folder.