This repository contains the code and data for our DASFAA 2023 paper:
Meta-Learning Siamese Network for Few-Shot TextClassification
If you find this work useful and use it on your own research, please cite our paper.
@inproceedings{han2023meta,
title={Meta-learning Siamese Network for Few-Shot Text Classification},
author={Han, Chengcheng and Wang, Yuhe and Fu, Yingnan and Li, Xiang and Qiu, Minghui and Gao, Ming and Zhou, Aoying},
booktitle={Database Systems for Advanced Applications: 28th International Conference, DASFAA 2023, Tianjin, China, April 17--20, 2023, Proceedings, Part III},
pages={737--752},
year={2023},
organization={Springer}
}
We ran experiments on a total of 6 datasets. You may unzip our processed data file data.zip
and put the data files under data/
folder.
Dataset | Notes |
---|---|
20 Newsgroups (link) | Processed data available. We used the 20news-18828 version, available at the link provided. |
Reuters-21578 (link) | Processed data available. |
Amazon reviews (link) | We used a subset of the product review data. Processed data available. |
HuffPost headlines (link) | Processed data available. |
RCV1 (link) | Processed data available. |
FewRel (link) | Processed data available. |
Please download pretrained word embedding file wiki.en.vec
from here and put it under pretrain_wordvec/
folder.
After you have finished configuring the data/
folder and the pretrain_wordvec/
folder, you can run our model with the following commands.
cd bin
sh 1-shot.sh
or
cd bin
sh 5-shot.sh
You can also adjust the model by modifying the parameters in the 1-shot.sh
or 5-shot.sh
file to run on diffrent data sets.
- Python 3.7
- PyTorch 1.6.0
- numpy 1.18.5
- torchtext 0.7.0
- termcolor 1.1.0
- tqdm 4.46.0
- CUDA 10.2