Official implementation of AAAI-21 paper "Label Confusion Learning to Enhance Text Classification Models"

Overview

Description:

This is the official implementation of our AAAI-21 accepted paper Label Confusion Learning to Enhance Text Classification Models.

The structure of LCM looks like this:

Here we provide some demo experimental code & datasets.

Environment:

python 3.6 tensorflow 2.2.0 keras 2.3.1

Run a Demo:

LCM-based LSTM:

Run python lcm_exp_on_lstm.py to compare the performance of LSTM, LSTM with label smoothing(LS) and LSTM with LCM.

LCM-based BERT:

Run python lcm_exp_on_bert.py to compare the performance of BERT, BERT with label smoothing(LS) and BERT with LCM.

The final results will be outputted to output/ directory.

The curve below shows our results on 20NG with LSTM as basic predictor. By changing the α, we can control the influence of LCM on the original model.

Comments
  • unzip datasets.zip error

    unzip datasets.zip error

    Archive:  datasets.zip
    warning [datasets.zip]:  zipfile claims to be last disk of a multi-part archive;
      attempting to process anyway, assuming all parts have been concatenated
      together in order.  Expect "errors" and warnings...true multi-part support
      doesn't exist yet (coming soon).
    file #1:  bad zipfile offset (local header sig):  4
    file #2:  bad zipfile offset (local header sig):  43
    file #3:  bad zipfile offset (local header sig):  87
    file #4:  bad zipfile offset (local header sig):  3472375
    file #5:  bad zipfile offset (local header sig):  8800734
    file #6:  bad zipfile offset (local header sig):  8800781
    file #7:  bad zipfile offset (local header sig):  8800872
    file #8:  bad zipfile offset (local header sig):  8801829
    file #9:  bad zipfile offset (local header sig):  9547300
    file #10:  bad zipfile offset (local header sig):  20530956
    file #11:  bad zipfile offset (local header sig):  20531003
    file #12:  bad zipfile offset (local header sig):  20531177
    file #13:  bad zipfile offset (local header sig):  20532155
    file #14:  bad zipfile offset (lseek):  75014144
    file #15:  bad zipfile offset (local header sig):  75016487
    file #16:  bad zipfile offset (lseek):  75481088
    file #17:  bad zipfile offset (lseek):  76800000
    file #18:  bad zipfile offset (lseek):  77160448
    file #19:  bad zipfile offset (lseek):  78184448
    
    opened by applenob 2
  • Possible typo error

    Possible typo error

    In the code for lstm.py (https://github.com/beyondguo/label_confusion_learning/blob/master/models/lstm.py) in line 133, there is a possible typo as the variable name is "pred_porbs". however, in line 137, the variable "pred_probs" is used for calculating the loss. The variable "pred_probs" is not passed to the function and might be incorrectly accessed from line 152.

    opened by nobeljacob 1
  • loss1 calculation question

    loss1 calculation question

    anything wrong here?https://github.com/beyondguo/label_confusion_learning/blob/da019ec43f221b5157e77004081bb6f2dc9e2143/models/bert.py#L140

    loss1 = -K.categorical_crossentropy(simulated_y_true,simulated_y_true)

    Why the 2 parameters are both "simulated_y_true"?

    opened by lni600 1
  • 关于多标签分类的应用

    关于多标签分类的应用

    您好,感谢作者提供一篇非常直观的paper。 现在想将标签间的混淆关系使用在多标签分类中。

    我尝试的修改: 将label_emb、text_emb部分的输出使用sigmoid激活,效果不理想。

    猜测是由于lcm_loss那也应该做适配的修改

    1. 将lcm_loss的softmax换成sigmoid,不行
    2. 不用KL散度,构造正负样本后用余弦相似度、均失败

    您看什么时间有空,可以增加multilabel的loss?感谢!

    opened by luoda888 0
  • 关于LCM论文效果的一点疑问

    关于LCM论文效果的一点疑问

    您好,非常感谢您的工作! 我注意到您在计算label_sim_dict时使用了Softmax,与one-hot相加后又使用了一次Softmax。 重复的Softmax会在很大程度上削弱数据的敏感性。

    因此,我进行了以下实验,以探究LCM的效果: 在20NG数据集上,我将batch size设为512,alpha设为0.5,其余参数跟您相同, 我发现,将lcm的作用对象从最后一层dense layer之前的input_vec,换到dense layer之后还没过Softmax的pred_score上,结果相比于lcm有两个点的提升。 进一步,我尝试了不使用lcm,用ground truth index直接从label embedding layer取embedding,softmax之后作为label_sim_dict,发现与上述效果相当。 进一步探究之后我发现,这一效果其实等同于将label smoothing设为e=0.9。 在LS上进行实验,效果也与上述情况相当。这样的话,label index位置相对于其他位置差异变小,拟合速度增快,且效果优于lcm。

    ———————————————————————————————————————— 基于上述原因,我想请问,您有试过将lcm和label smoothing更大的情况进行对比吗?论文中得到的结果是因为LCM捕捉到了label之间的关系,还是仅仅相当于设置了更大的label smoothing呢?

    仅仅是一些粗浅的意见,希望对您有帮助~😊

    opened by hemingkx 6
Owner
null
An official source code for paper Deep Graph Clustering via Dual Correlation Reduction, accepted by AAAI 2022

Dual Correlation Reduction Network An official source code for paper Deep Graph Clustering via Dual Correlation Reduction, accepted by AAAI 2022. Any

yueliu1999 109 Dec 23, 2022
Official repository of the AAAI'2022 paper "Contrast and Generation Make BART a Good Dialogue Emotion Recognizer"

CoG-BART Contrast and Generation Make BART a Good Dialogue Emotion Recognizer Quick Start: To run the model on test sets of four datasets, Download th

null 39 Dec 24, 2022
Official implementation for (Show, Attend and Distill: Knowledge Distillation via Attention-based Feature Matching, AAAI-2021)

Show, Attend and Distill: Knowledge Distillation via Attention-based Feature Matching Official pytorch implementation of "Show, Attend and Distill: Kn

Clova AI Research 80 Dec 16, 2022
Official PyTorch implementation of "Proxy Synthesis: Learning with Synthetic Classes for Deep Metric Learning" (AAAI 2021)

Proxy Synthesis: Learning with Synthetic Classes for Deep Metric Learning Official PyTorch implementation of "Proxy Synthesis: Learning with Synthetic

NAVER/LINE Vision 30 Dec 6, 2022
Implementation of accepted AAAI 2021 paper: Deep Unsupervised Image Hashing by Maximizing Bit Entropy

Deep Unsupervised Image Hashing by Maximizing Bit Entropy This is the PyTorch implementation of accepted AAAI 2021 paper: Deep Unsupervised Image Hash

null 62 Dec 30, 2022
Pytorch implementation of the AAAI 2022 paper "Cross-Domain Empirical Risk Minimization for Unbiased Long-tailed Classification"

[AAAI22] Cross-Domain Empirical Risk Minimization for Unbiased Long-tailed Classification We point out the overlooked unbiasedness in long-tailed clas

PatatiPatata 28 Oct 18, 2022
Parallel and High-Fidelity Text-to-Lip Generation; AAAI 2022 ; Official code

Parallel and High-Fidelity Text-to-Lip Generation This repository is the official PyTorch implementation of our AAAI-2022 paper, in which we propose P

Zhying 77 Dec 21, 2022
This is the code for the paper "Contrastive Clustering" (AAAI 2021)

Contrastive Clustering (CC) This is the code for the paper "Contrastive Clustering" (AAAI 2021) Dependency python>=3.7 pytorch>=1.6.0 torchvision>=0.8

Yunfan Li 210 Dec 30, 2022
Source code for paper "Document-Level Relation Extraction with Adaptive Thresholding and Localized Context Pooling", AAAI 2021

ATLOP Code for AAAI 2021 paper Document-Level Relation Extraction with Adaptive Thresholding and Localized Context Pooling. If you make use of this co

Wenxuan Zhou 146 Nov 29, 2022
This is the repository for the AAAI 21 paper [Contrastive and Generative Graph Convolutional Networks for Graph-based Semi-Supervised Learning].

CG3 This is the repository for the AAAI 21 paper [Contrastive and Generative Graph Convolutional Networks for Graph-based Semi-Supervised Learning]. R

null 12 Oct 28, 2022
Code for the AAAI 2022 paper "Zero-Shot Cross-Lingual Machine Reading Comprehension via Inter-Sentence Dependency Graph".

multilingual-mrc-isdg Code for the AAAI 2022 paper "Zero-Shot Cross-Lingual Machine Reading Comprehension via Inter-Sentence Dependency Graph". This r

Liyan 5 Dec 7, 2022
Code for the AAAI-2022 paper: Imagine by Reasoning: A Reasoning-Based Implicit Semantic Data Augmentation for Long-Tailed Classification

Imagine by Reasoning: A Reasoning-Based Implicit Semantic Data Augmentation for Long-Tailed Classification (AAAI 2022) Prerequisite PyTorch >= 1.2.0 P

null 16 Dec 14, 2022
PyTorch Implementation for AAAI'21 "Do Response Selection Models Really Know What's Next? Utterance Manipulation Strategies for Multi-turn Response Selection"

UMS for Multi-turn Response Selection Implements the model described in the following paper Do Response Selection Models Really Know What's Next? Utte

Taesun Whang 47 Nov 22, 2022
Scalable Attentive Sentence-Pair Modeling via Distilled Sentence Embedding (AAAI 2020) - PyTorch Implementation

Scalable Attentive Sentence-Pair Modeling via Distilled Sentence Embedding PyTorch implementation for the Scalable Attentive Sentence-Pair Modeling vi

Microsoft 25 Dec 2, 2022
git《Commonsense Knowledge Base Completion with Structural and Semantic Context》(AAAI 2020) GitHub: [fig1]

Commonsense Knowledge Base Completion with Structural and Semantic Context Code for the paper Commonsense Knowledge Base Completion with Structural an

AI2 96 Nov 5, 2022
git《Self-Attention Attribution: Interpreting Information Interactions Inside Transformer》(AAAI 2021) GitHub:

Self-Attention Attribution This repository contains the implementation for AAAI-2021 paper Self-Attention Attribution: Interpreting Information Intera

null 60 Dec 29, 2022
《Fst Lerning of Temporl Action Proposl vi Dense Boundry Genertor》(AAAI 2020)

Update 2020.03.13: Release tensorflow-version and pytorch-version DBG complete code. 2019.11.12: Release tensorflow-version DBG inference code. 2019.1

Tencent 338 Dec 16, 2022
[AAAI 2021] MVFNet: Multi-View Fusion Network for Efficient Video Recognition

MVFNet: Multi-View Fusion Network for Efficient Video Recognition (AAAI 2021) Overview We release the code of the MVFNet (Multi-View Fusion Network).

Wenhao Wu 114 Nov 27, 2022
《LightXML: Transformer with dynamic negative sampling for High-Performance Extreme Multi-label Text Classification》(AAAI 2021) GitHub:

LightXML: Transformer with dynamic negative sampling for High-Performance Extreme Multi-label Text Classification

null 76 Dec 5, 2022