Giter Club home page Giter Club logo

lcl_loss's Introduction

Label-aware Contrastive Loss

This repo contains the pytorch implementation of Label-aware Contrastive Loss (LCL).

Dataset preprocess

Download datasets from the given data source links, Empathetic Dialogue, GoEmotions, ISEAR, EmoInt SST-2,SST-5

For Empathetic Dialogue dataset, an additional extraction of the raw data was done to get the csv files using ed_data_extract.py which is required for the below pre-processing

python data_preprocess.py -d <dataset name> --aug ## for emotion datasets
python sst_data_preprocess.py -d <dataset name> --aug ## for sentiment datasets

Training the model

Set the parameters in config.py

python train.py

Credits

We took help from the following open source projects and we acknowledge their contributions.

  1. Supervised Contrastive Loss https://github.com/HobbitLong/SupContrast
  2. SST-tree2tabular https://github.com/prrao87/fine-grained-sentiment/blob/master/data/sst/tree2tabular.py
  3. Tweet preprocess https://github.com/cbaziotis/ntua-slp-semeval2018.git
  4. Tweet preprocess https://github.com/abdulfatir/twitter-sentiment-analysis.git

Note: There is minor typo in Eq 3 in the paper relating to the placement of weight wi yi (i.e the positive weights which are constant for a given sample). It is meant to be outside the log and is correctly implemented in the code. The results in the paper follow the current implementation.

lcl_loss's People

Contributors

varsha33 avatar

Stargazers

 avatar  avatar QiangZhou avatar  avatar  avatar  avatar  avatar dong yang avatar Jaehoon Kim avatar Jiayi Liu avatar Aflah avatar luke.4.18 avatar  avatar Doc J avatar wanghl21 avatar hackaday avatar Keyang, Ding avatar  avatar  avatar Kim Kang Min avatar Narasimman avatar  avatar  avatar AndyZzzz avatar Mark Friel avatar Michael Fu avatar Zhengyuan Wen avatar Prithivida avatar Jieyu Zhang avatar  avatar  avatar Yongyi (Ethan) Wu avatar  avatar yayuanzi8 avatar  avatar  avatar  avatar

Watchers

James Cloos avatar  avatar

lcl_loss's Issues

The classes in 4-hard-d

Hey,

In the paper, the 4-hard-d is {Anticipating, Excited, Hopeful, Guilty}. We re-ran all the experiments in section 5.3 "case study" and found the one for 4-hard-d is very different from what is reported in the paper while other results are similar. Just wondering if by any chance you could double-check your experiment to see whether the classes in 4-hard-d are correct? BTW they seem to be less "hard" than 4-hard-a/b/c...

About Eq.3

Hey,

I think if you really meant to place w outside of log in Eq.3, then in this line it should time logits_mask instead of weighted_mask, right?

Thanks

a question for model structure---

i notice that the contextual text encoder also has a classifier branch for classification, why not just using the result of this classifier as weighting? is there some reason to train another weighting network ?

config.py Parameters

Hi. Thanks for the great repo. I was wondering what other values can each of the below parameters get in the config.py file. Since they are strings and should be accurate, I would appreciate it if you could provide all the possible values. Thank you.

criterion 
loss_type
model_type

How many epochs we need to reproduce the experimental results?

Hey,

I checked the paper and noticed that the number of epochs needed is not specified in the paper- would much appreciate it if you could provide the number of epochs needed for each data coz I found that setting it to 5 (as in the code) for the ed dataset cannot produce the accuracy as reported.

Thanks!

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.