Git Product home page Git Product logo

hypemo's Introduction

HypEmo

The implementation of the ACL 2023 paper Label-Aware Hyperbolic Embeddings for Fine-grained Emotion Classification.

This code is tested under Python3.10.11.

Training

First, install the packages via the following command: pip install -r requirements.txt

you can optionally open config.py to change the dataset and hyperparameters.

Afterward, just run python train.py to start training!

Hyperparameters

You can find hyperparameters in config.py.

For GoEmotion dataset, we set alpha=0.9 and gamma=0.1.

For EmpatheticDialogues dataset, we set alpha=1.0 and gamma=0.25.

We use 1234 as the default random seed for all experiments.

Note

train_label_embedding.py contains the script for training the hyperbolic label embeddings.

This script originates from https://github.com/dalab/hyperbolic_cones.

If you are using other datasets, you may run this script on your custom label to obtain hyperbolic embeddings.

Once it is done, you will get a .bin in the label_tree folder, and you can run the main script by train.py.

If you are not using a custom dataset, you can skip this section and directly run train.py.

Credit

We have prepared all the processed data in the data folder, which is from GoEmotion and EmpatheticDialogues. We also rely on Hyperbolic cones to learn hyperbolic embeddings.

hypemo's People

Contributors

dinobby avatar

Stargazers

 avatar Rendi Chevi avatar  avatar  avatar soda avatar  avatar huguanghong avatar -3σ avatar  avatar Bastien Hoorelbeke avatar Jens Van Nooten avatar RuiLiu avatar HuntingGame avatar Jeff Carpenter avatar  avatar

Watchers

 avatar

hypemo's Issues

Exponential / Logarithmic maps

Hi! I was wondering which classes/functions should be used to map, for example, a BERT embedding to the hyperbolic space (using the Poincaré ball model). In the paper it is mentioned that you use an exponential map, but I am not sure where this can be found in the code. Is it e.g. line 106 in hypbert.py, or do you need to use PoincareBall Manifold class in poincare.py?

(FYI: I'm not referring to training label embeddings; just the projections)

Thanks!

Possibility of adapting to the go-emotion original multilabel task

Hello sir, just read your paper and I’m really fascinated by your good F1 numbers. However I want to apply your proposed model on the go-emotion original multi label setup. I made the following attempts and modifications:

  1. Change the dataset to be the original go-emotion dataset
  2. When calculating CE_loss, Replace Cross-entropy with Binary cross entropy
  3. If a training instance has multiple labels, average every individual label’s hyperbolic arrays to get its label_vec. (I’m sorry if this step seems too straightforward and naive. I have little knowledge about the Hyperbolic space and I think it’s infeasible to create a hyperbolic array for every unique label combination as the variations are too many.)

Weirdly, I ended up with getting some very strange results. Specifically, the Poincaré loss term inside the total loss calculation becomes negative values from the end of the first epoch and onwards. The negative values grows smaller and smaller, ultimately causes the total loss term become negative. I’ve made some simple investigations and found that it’s due to the dot_product term(in Poincaré model compute_metrics() function) value becoming too large.

Can you please suggest which part I did wrong? Should I also change some hyper parameters in the hyperbolic part to resolve negative loss issue? Do you think your model theoretically support multi label task and can be easily adapted to?

Sorry for the lengthy questions. Really appreciate your time and assistance!

two bugs

I am trying to run in my dataset, and found two bugs:
Bug1: show_node_labels is not defined in train_label_embedding.py
Bug2: When running train_label_embedding.py line 36 will cause error, because your config.py will run the last several lines.

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.