GithubHelp home page GithubHelp logo

zhixiuye / mlman Goto Github PK

View Code? Open in Web Editor NEW
60.0 2.0 19.0 24 KB

ACL 2019 paper:Multi-Level Matching and Aggregation Network for Few-Shot Relation Classification

Home Page: https://www.aclweb.org/anthology/P19-1277

Python 100.00%
nlp few-shot-learning pytorch relation-classification sentence-match

mlman's Introduction

Multi-Level Matching and Aggregation Network

Dependencies

The code is written in Python 3.6 and pytorch 1.0.0.

Evaluation Results

Model 5 Way 1 Shot 5 Way 5 Shot 10 Way 1 Shot 10 Way 5 Shot
MLMAN 82.98 ± 0.20 92.66 ± 0.09 75.59 ± 0.27 87.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",
}

mlman's People

Contributors

zhixiuye avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mlman's Issues

效果

您好,根据您的ReadMe,代码运行,最后线下的效果5-way-1-shot大概78.3左右,请问正常吗,是提交后,test结果普遍比线下高吗?

在1 shot设置下的实验结果

您好,我重新运行了您的代码,并提交测试,在1 shot上的结果和您提供的结果有些不同,
5 way 1 shot的结果为 81.54,
10 way 1 shot的结果为 72.31,
请问是在训练1 shot时有需要修改的地方吗?

请问能解释一下全连接层和lstm这样初始化的原因吗?

全连接层初始化代码
bias = np.sqrt(6.0 / (input_linear.weight.size(0) + input_linear.weight.size(1))) nn.init.uniform_(input_linear.weight, -bias, bias) if input_linear.bias is not None: input_linear.bias.data.zero_()
lstm层初始化代码
for ind in range(0, input_lstm.num_layers): weight = eval('input_lstm.weight_ih_l' + str(ind)) bias = np.sqrt(6.0 / (weight.size(0) / 4 + weight.size(1))) nn.init.uniform_(weight, -bias, bias) weight = eval('input_lstm.weight_hh_l' + str(ind)) bias = np.sqrt(6.0 / (weight.size(0) / 4 + weight.size(1))) nn.init.uniform_(weight, -bias, bias)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.