Home

Awesome

Multi-Level Matching and Aggregation Network

Dependencies

The code is written in Python 3.6 and pytorch 1.0.0.

Evaluation Results

Model5 Way 1 Shot5 Way 5 Shot10 Way 1 Shot10 Way 5 Shot
MLMAN82.98 ± 0.2092.66 ± 0.0975.59 ± 0.2787.29 ± 0.15

Usage

  1. download train.json and val.json from here

  2. download glove.6B.50d.json from here

  3. make data folder in the following structure

MLMAN
|-- data
    |-- glove.6B.50d.json
    |-- train.json
    |-- val.json
|-- models
    |-- data_loader.py
    |-- embedding.py
    |-- framework.py
    |-- MLMAN.py
    |-- utils.py
|-- README.md
|-- train_demo.py
  1. train model
CUDA_VISIBLE_DEVICES=0 python train_demo.py --N_for_train 20 --N_for_test 5 --K 1 --Q 5 --batch 1

Cite

If you use the code, please cite the following paper: "Multi-Level Matching and Aggregation Network for Few-Shot Relation Classification" Zhi-Xiu Ye, Zhen-Hua Ling. ACL (2019)

@inproceedings{ye-ling-2019-multi,
    title = "Multi-Level Matching and Aggregation Network for Few-Shot Relation Classification",
    author = "Ye, Zhi-Xiu  and
      Ling, Zhen-Hua",
    booktitle = "Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics",
    month = jul,
    year = "2019",
    address = "Florence, Italy",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/P19-1277",
    pages = "2872--2881",
}