Git Product home page Git Product logo

dl-sentiment's Introduction

Deep Learning: Sentiment Analysis

This is the semester project I did for the course "Deep Learning" taught by Daniël de Kok at the University of Tübingen in the summer semester 2017.

Using Tensorflow, I have implemented a bidirectional recurrent neural network (biRNN) that is classifying tweets according to their conveyed emotion (anger, disgust, fear, joy, sadness and surprise) leveraging information from word embeddings, entries in an emotion-annotated lexicon and character-level embeddings. My model reaches a micro-averaged F1 score of 62.81 and a macro-averaged F1 score of 52.91.

Details on the design and implementation can be found in the accompanying project plan/proposal and report (under doc).

External resources

  • This project uses the (word-level) NRC Emotion Lexicon, created by Saif M. Mohammad and Peter D. Turney at the National Research Council Canada.
  • It also uses the pre-trained Twitter word vectors from GloVe which are made available under the Public Domain Dedication and License v1.0 whose full text can be found at: http://www.opendatacommons.org/licenses/pddl/1.0/.

Preprocessing

The original GloVe embeddings were far too verbose for my purpose, so I stripped the unused information in a first preprocessing step, also to reduce their enormous size. Download the pre-trained Twitter word vectors from their website (I used the 200d vectors), apply get_embeddings(<filename>, 100000) from preprocessing.py to them and picklethe result into a file (cf. preprocessing.main).

Data format

The training and validation data has to be provided in a very simple tab-separated format with three columns; the first being completely irrelevant (the original data provided by the lecturer contained a tweet id), the second column containg the Tweet text and the third column containing two colons followed by the emotion class. For example:

<tweet_id>    i'm SO happy today!!! #yippie    :: joy

Usage

To run the model, use the following command:

python train.py TRAIN_DATA TEST_DATA EMBEDDINGS EMOLEX

where TRAIN_DATA is the data the model should be trained on and TEST_DATA is the data to evaluate on. EMBEDDINGS should be the file containing the preprocessed word embeddings and EMOLEX the one with the NRC Emotion Lexicon data.

For more options, refer to doc/project_report.pdf.

dl-sentiment's People

Contributors

tdaneyko avatar

Watchers

 avatar

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.