Coder Social home page Coder Social logo

rktamplayo / chim Goto Github PK

View Code? Open in Web Editor NEW
23.0 4.0 8.0 14 KB

[EMNLP2019] Rethinking Attribute Representation and Injection for Sentiment Classification

License: MIT License

Python 100.00%
chim sentiment-classification attribute-representation sentiment-analysis sentiment attribute-injection user-representation review-rating-prediction deep-learning machine-learning

chim's Introduction

CHIM

[EMNLP2019] Rethinking Attribute Representation and Injection for Sentiment Classification

This PyTorch code was used in the experiments of the research paper

Reinald Kim Amplayo. Rethinking Attribute Representation and Injection for Sentiment Classification. EMNLP, 2019.

Data

IMDB, Yelp2013, and Yelp2014 datasets are originally from here. I did some changes, which I cannot unfortunately recall everything, with the format (not the content) of the file (e.g., changed the ordering of the input and output, etc.).

I am therefore sharing my version of the above datasets, as well as the Amazon datasets in the paper, in this link. The link will direct you to a directory named data. You will need to download GloVe vectors as well and save the file as glove.txt inside the data directory.

If you are using any of the above three datasets, please also cite the original paper. The BibTeX is shown at the end.

Train and Evaluate CHIM

To train the model, simply run using the format:

python src/train.py <dataset> weight.chunk.imp <inject_location> 300 <chunk_ratio> <gpu_device>

where:

  • dataset is the name of the dataset directory dataset folder (e.g., yelp2013).
  • inject_location is the location to inject the attributes. Choose from the following: embed, encode, pool, classify. Multiple locations can also be used by separating them with a comma (e.g., embed,encode)
  • chunk_ratio is the chunk size factors discussed in the paper. The one used in the paper is 15.
  • gpu_device is the GPU device number.

Evaluation is done similarly, but with another file:

python src/evaluate.py <dataset> weight.chunk.imp <inject_location> 300 <chunk_ratio> <gpu_device>

Cite the Necessary Papers

To cite the paper/code/data splits, please use this BibTeX:

@inproceedings{amplayo2019rethinking,
	Author = {Reinald Kim Amplayo},
	Booktitle = {EMNLP},
	Location = {Hong Kong, China},
	Year = {2019},
	Title = {Rethinking Attribute Representation and Injection for Sentiment Classification},
}

If using either of the IMDB/Yelp2013/Yelp2014 datasets, please also cite the original authors of the datasets:

@inproceedings{tang2015learning,
	Author = {Duyu Tang and Bing Qin and Ting Liu},
	Booktitle = {ACL},
	Location = {Beijing, China},
	Year = {2015},
	Title = {Learning Semantic Representations of Users and Products for Document Level Sentiment Classification},
}

If there are any questions, please send me an email: reinald.kim at ed dot ac dot uk

chim's People

Contributors

rktamplayo 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

Watchers

 avatar  avatar  avatar  avatar

chim's Issues

an exception

In train.py

from tqdm import tqdm
import sys
import os

using the following line gets an exception.

dim = int(sys.argv[5])

using the following line works.

dim = int(sys.argv[4])

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.