Concept Learners for Few-Shot Learning
Kaidi Cao*, Maria Brbić*, Jure Leskovec
This repo contains the reference source code in PyTorch of the COMET algorithm. COMET is a meta-learning method that learns generalizable representations along human-understandable concept dimensions. For more details please check our paper Concept Learners for Few-Shot Learning (ICLR '21).
Dependencies
The code is built with following libraries:
Getting started
CUB dataset
- Change directory to
./filelists/CUB
- Run
source ./download_CUB.sh
Tabula Muris dataset
- Change directory to
./filelists/tabula_muris
- Run
source ./download_TM.sh
Usage
Training
We provide an example here:
Run
python ./train.py --dataset CUB --model Conv4NP --method comet --train_aug
Testing
We provide an example here:
Run
python ./test.py --dataset CUB --model Conv4NP --method comet --train_aug
Tabula Muris benchmark
If you would like to test your algorithm on the new benchmark dataset introduced in our work, you can download the data as described above or directly at http://snap.stanford.edu/comet/data/tabula-muris-comet.zip.
Dataset needs to be preprocessed using preprocess.py. Train/test/validation splits are available in load_tabula_muris.
Running this code requires anndata and scanpy libraries.
Citing
If you find our code useful, please consider citing:
@inproceedings{
cao2021concept,
title={Concept Learners for Few-Shot Learning},
author={Cao, Kaidi and Brbi\'c, Maria and Leskovec, Jure},
booktitle={International Conference on Learning Representations (ICLR)},
year={2021},
}
Our codebase is developed based on the benchmark implementation from paper A Closer Look at Few-shot Classification.
Tabula Muris benchmark is developed based on the mouse aging cell atlas from paper https://www.nature.com/articles/s41586-020-2496-1.