Giter Club home page Giter Club logo

word-embedding-sst's Introduction

Sentiment-Analysis Using Word Embedding & LSTM & Attention

License: MIT

[简体中文 | English]


Use GloVe/Word2Vec embedding, LSTM and Attention to do SST sentiment classification.


Word to idx is ready in /output_data directory


We use 2 word embedding technique: GloVe & Word2Vec

GLoVe: We use glove.840B.300d.txt. You can download it from stanfordnlp

Word2Vec: We use GoogleNews-vectors-negative300.bin. You can download .gz file from google drive


Results on DEV

Model Accuracy Precision Recall F1
Word2Vec+LSTM+Attn 78.4 78.4 78.4 78.4
Word2Vec+GRU+Attn 79.2 79.2 79.2 79.2
GloVe+LSTM+Attn 83.9 83.9 83.9 83.9
GloVe+GRU+Attn 85.1 85.1 85.0 85.1
GloVe+LSTM 83.5 83.6 83.5 83.5
GloVe+GRU 84.5 84.5 84.5 84.5
  • It's obvious that word embedding play an important roll in training
  • In this project, we set large dropout for better test performance
  • Models with Attention outperform those without 0.5% approximately

Run this PJ(train)

python main.py run

Test and Get Predictions

If you have a test.tsv different from the one in this project's ./data/SST directory, you should rename your test.tsv to test_pj.tsv, put it in the ./data/SST directory, and simply run:

python preprocess.py

If you encounter any trouble, here may have some details.

This will use the saved word map to interpret your test.tsv to tokens.

For testing and getting predictions, simply run:

python main.py run --status='test' --best_model="checkpoints/BEST_checkpoint_SST-2_TextAttnBiLSTM_SST.pth"

The prediction for test dataset will be saved in ./prediction.tsv

Parameters

Refer to class ModelConfig in TextAttnBiLSTM.py and configurations in config.py

LICENSE

This is a course project

Reimplementation of word-embedding nlp model

With several more features:

  • You don't need to download pre-trained word-embedding model if you are using SST dataset

  • You can simply run main.py and get a model

  • More information for model analysis metrics

Unsatisfied with the Accuracy?

Here for implementation of SOTA model


Acknowledgment

This project is based on this repo@Doragd


word-embedding-sst's People

Contributors

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