Giter Site home page Giter Site logo

1429904852 / ldf Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 3.0 5.5 MB

[Findings of EMNLP 2022] Label-Driven Denoising Framework for Multi-Label Few-Shot Aspect Category Detection

Home Page: https://aclanthology.org/2022.findings-emnlp.177.pdf

License: Apache License 2.0

Python 100.00%

ldf's Introduction

LDF

Code and data for "Label-Driven Denoising Framework for Multi-Label Few-Shot Aspect Category Detection" (Findings of EMNLP 2022)

Overview

  • In this paper, we propose a Label-Driven Denoising Framework (LDF) to alleviate the noise problems for the FS-ACD task.
  • Label-Driven Denoising Framework contains a label-guided attention strategy to filter noisy words and generate a representative prototype for each aspect, and a label-weighted contrastive loss to avoid generating similar prototypes for semantically-close aspect categories.

Setup

Requirements

+ python 3.7
+ tensorflow 2.4.0
+ keras 2.4.3
+ sklearn 0.0
+ numpy 1.19.5

Download word embedding

please download the glove.6B.50d embedding in JSON format: [Link], or in txt format: [StanfordNLP] and put it under word_embedding folder

Model configuration

  • you can choose one or multiple methods at one time in the model_list
e.g., model_list = [None, 'AWATT_LAS', 'LDF_AWATT']

# code:             corresponding model:
#  None             the original AWATT model
# 'AWATT_LAS'       AWATT+LAS
# 'AWATT_LCL'       AWATT+LCL
# 'AWATT_SCL'       AWATT+SCL
# 'LDF_AWATT'       LDF-AWATT
# 'HATT'            the original HATT model
# 'HATT_LAS'        HATT+LAS
# 'HATT_LCL'        HATT+LCL
# 'HATT_SCL'        HATT+SCL
# 'LDF-HATT'        LDF-HATT
  • you can choose one or multiple datasets at one time in the dataset_list
e.g., dataset_list = ['FewAsp', 'FewAsp(single)', 'FewAsp(multi)']
  • you can choose one or multiple configs at one time in the config_list
e.g., config_list = [[2, 5, 5], [1, 5, 10], [1, 10, 5], [1, 10, 10]]

# [2, 5, 5] stands for: two(2) '5'-way-'5'-shot meta-tasks for two batch-size
# [1, 5, 10] stands for: one(1) '5'-way-'10'-shot meta-task for one batch-size
# [1, 10, 5] stands for: one(1) '10'-way-'5'-shot meta-task for one batch-size
# [1, 10, 10] stands for: one(1) '10'-way-'10'-shot meta-task for one batch-size

Usage

  • You can use the following command to train and test LDF on the FS-ACD task:
python train_and_test.py
  • The final results can be saved in the excel file you specified:
e.g., pd.DataFrame(result_list).to_excel('result.xlsx')

Implementation details

  • The implementation of Label-weighted Contrastive Loss follows the simplification below:
  • For the numeric results in the experiments, we take 5 runs covering seeds [5, 10, 15, 20, 25]. Different GPUs and versions of Keras/TensorFlow might give different results. Feel free to use our code, re-implement, and re-run the experiments!

  • For the implementation of model [AWATT] whose code is not available when we are working on LDF, in order to achieve the reported results, our implementation slightly differs from what is described in [paper].

Build your own model

you can augment your own model with LDF by:

  • Introduce label text into the Attention module to help focus on salient information that benefits classification;

  • Add our Label-weighted Contrastive Loss.

Citation

If the code is used in your research, please cite the paper:

@inproceedings{zhao-etal-2022-label,
    title = "Label-Driven Denoising Framework for Multi-Label Few-Shot Aspect Category Detection",
    author = "Zhao, Fei  and
      Shen, Yuchen  and
      Wu, Zhen  and
      Dai, Xinyu",
    booktitle = "Findings of the Association for Computational Linguistics: EMNLP 2022",
    month = dec,
    year = "2022",
    address = "Abu Dhabi, United Arab Emirates",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2022.findings-emnlp.177",
    pages = "2390--2402"
}

If the data is used in your research, please cite the paper:

@inproceedings{hu-etal-2021-multi-label,
    title = "Multi-Label Few-Shot Learning for Aspect Category Detection",
    author = "Hu, Mengting and Zhao, Shiwan and Guo, Honglei and Xue, Chao and Gao, Hang and Gao, Tiegang and Cheng, Renhong and Su, Zhong",
    booktitle = "Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers)",
    month = aug,
    year = "2021",
    address = "Online",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2021.acl-long.495",
    doi = "10.18653/v1/2021.acl-long.495",
    pages = "6330--6340",
}

ldf's People

Contributors

1429904852 avatar a-chicharito-s avatar

Stargazers

 avatar  avatar Yuqing Li avatar 关关 avatar  avatar Chen gao avatar  avatar Gates Bin avatar

Watchers

 avatar

ldf's Issues

关于训练过程的标准

有几个疑惑没想明白:
1、采用多少个epochs,每个epoch又分task训练800次,验证600次吗?
2、5-way、5-shot中:每个epoch随机选取5 * 5个suppor和5个query(也就是总共30条数据)吗?还是每个task随机选取5 * 5个suppor和5个query吗(也就是总共800 * 30+600 * 30条
3、5-way、5-shot中两个batch是分别取两次随机数据吗(也就是总共60条数据)?
image
数据)?

关于softmax的问题

最后我们会得到每个样本对每个原型的距离:
那么我们softmax是对一个样本对每个原型的距离,
还是说每个样本对其中一个原型的softmax。

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.