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
If you do not installed pytorch, downlaod from [https://pytorch.org/get-started/locally/]
- Git clone
$git clone https://github.com/chanhee-kang/twieet-sentiment-analysis-LSTM.git
- Install packages
$python -m spacy download en
-
CUDA and CUDNN (for GPU acceleration/OPTIONAL)
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) -
Install the rest of modules.
pip install "library Name".
- model.py (network structure)
- data_loader.py (load data set)
- test.py (load network weight and load vocabulary and inference)
- label.pkl (stored label)
- best_model.pt (model weight)
- text.pkl (stored text)
-
USE
train.py
for training -
USE
test.py
for testing
pred_class = predict_class(model,TEXT, "TYPE YOUT SENTENCE")
print(f'Predicted class is: {ix_to_label[pred_class]}')
-
Sentiment Analysis
LET'S type "I really really love you baby. my sweet heart"
The model predicts the sentense as postive :)
The Datasets is too low 😭
More datasets will increase the performance
If you have any requests, please contact: https://ck992.github.io/.