Steps to reproduce the experiment using the code:
-
Download the KMNIST dataset from the GitHub page in the numpy format: KMNIST Dataset. It consists of four files, two for training and two for testing. Each pair of files contains images and labels.
-
Install the required libraries:
- numpy
- torch
- torchvision
- skorch
- modAL
- seaborn
- matplotlib
- scikit-learn
- wandb (wandb will also require registration to the service before running the code)
-
After registering with wandb, follow these instructions to properly log in and track your experiments: Wandb Quickstart.
-
When loading the datasets in the code, use np.load() and specify the path where you saved the downloaded dataset.
-
If the experiment is run on a non-Apple chip, set the device to “coda” instead of “mps”. Replace the line of code in the dedicated cell under “set device to gpu”.
-
Choose the query strategy in the “Active Learning Loop” section among the three alternatives proposed. Adjust model.train() and model.eval() as instructed in the code comments, in the for loop below.
-
For non-MC dropout strategies, remove the “sample_per_forward_pass” and “num_cycles” parameters, as they are only required by the BALD MC dropout strategy.
-
Adjust the wandb initialization with the name of your project and configuration details.
-
Run the code.