Skip to content

Latest commit

 

History

History
62 lines (51 loc) · 2.14 KB

README.md

File metadata and controls

62 lines (51 loc) · 2.14 KB

Predcting Sentiment LSTM

The model predicts sentence whether it is postive, negative, or netural

Datasets

You can download from: [https://www.kaggle.com/c/tweet-sentiment-extraction]
The file is for twieet sentiment extraction but I used for predicting sentiment

Deep Learning Frame Work

pytorch
If you do not installed pytorch, downlaod from [https://pytorch.org/get-started/locally/]

set up

  1. Git clone
$git clone https://github.com/chanhee-kang/twieet-sentiment-analysis-LSTM.git
  1. Install packages
$python -m spacy download en
  1. CUDA and CUDNN (for GPU acceleration/OPTIONAL)

    nvidia

    You need NVIDA GPU for CUDA. Please download from [https://developer.nvidia.com/cuda-toolkit-archive]
    If you do not have GPU, it is perfectly ok with using CPU. CUDA and CUDNN is just option)

  2. Install the rest of modules.

pip install "library Name".

File explaination

  1. model.py (network structure)
  2. data_loader.py (load data set)
  3. test.py (load network weight and load vocabulary and inference)
  4. label.pkl (stored label)
  5. best_model.pt (model weight)
  6. text.pkl (stored text)

Get Start

  1. USE train.py for training

  2. USE test.py for testing

pred_class = predict_class(model,TEXT, "TYPE YOUT SENTENCE")
print(f'Predicted class is:  {ix_to_label[pred_class]}')

Result

  1. Training
    epoch

  2. Sentiment Analysis
    LET'S type "I really really love you baby. my sweet heart"
    The model predicts the sentense as postive :)

    test

Limitation

The Datasets is too low 😭
More datasets will increase the performance

Contact

If you have any requests, please contact: https://ck992.github.io/.