Coder Social home page Coder Social logo

vaibhav2903 / ekman-emotion-detection Goto Github PK

View Code? Open in Web Editor NEW

This project forked from valendrew/ekman-emotion-detection

0.0 0.0 0.0 2.3 MB

Recurrent Neural Network for Emotion Detection, trained on the Ekman's six emotions dataset.

Jupyter Notebook 100.00%

ekman-emotion-detection's Introduction

Sentiment Analysis on Ekman's Six Basic Emotions Corpus

This repository contains the work done for the Deep Learning exam in the Master's Degree in Artificial Intelligence at University of Bologna during the A.Y. 2021/2022.

However, it was one of the first approach with the Keras library, and in general with Deep Learning, for this reason some choices might be unpopular or not properly reported.

The work was done in a Colab Notebook, hence it's recommended to run the notebook in the same environment. However, there shouldn't be any problems in other IPython Notebooks, except for some limitations (e.g. mounting the personal Google Drive storage).

The model achieves one of the highest score during the exam, 0.6070 for the macro F1-score.

Prerequisites

The notebooks made some assumptions.

  • Installed libraries are TensorFlow, Keras, Pandas, Matplotlib, Scikit-learn and Numpy.
  • The tested Python version is 3.8.

Other libraries are installed directly in the notebook through pip. They are:

  • Tensorflow addons: to compute an approximation of the F1-score as a metric of the network.
  • Preprocessing libraries: Contractions, Emoji and Ekphrasis.

The model must respect guidelines made by the professor, such as a limited model size and achieve an higher macro F1-score.

Implementation

Dataset

The used dataset is "Ekman's size Basic Emotions", well-popular in sentiment classification tasks, which is structured in three columns, "Text", "Emotion and "Id", but the last one had been discarded. Each entry in the dataset contains a text and an associated emotion, among the six available (joy, neutral, surprise, anger, sadness, disgust and fear).

Some preprocessing techniques had been applied, such as transforming words in lowercase, replacing emojis with a text identifier (similar emojis are mapped to the same text) and some specific social network processing with the Ekphrasis library (e.g. elongated words). These were necessary to improve the model performance.

An insight on distribution of the classes, the number of samples, the train-test split are better described in the notebook.

Model

The overall pipeline is structured as follows:

  • TextVectorization layer for tokenizing words.
  • Embedding layer loaded from the GloVE 6B vocabulary with 300 dimensions. It was set as non trainable afterwards, hence only the precomputed weights are considered.
  • LSTM model.

The network architecture had Spatial Dropout applied on the Embedding layer, a few Bidirectional LSTM layers, dropout layers and a Dense layer for classifying.

Some regularizations and hyperparameters tuning were done to achieve higher scores and avoid overfitting.

ekman-emotion-detection's People

Contributors

valendrew 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.