Sentiment Analysis Models
This repository contains multiple trained sentiment analysis models for binary sentiment classification (Positive / Negative).
Repository Structure
Sentiment/
│
├── BERT/
├── Bi_LSTM/
├── Linear_Svm/
├── Logistic_Regression/
├── Lstm/
├── Naive Bayes/
├── XGBoost/
└── Notebooks/
Available Models
- BERT
- LSTM
- Bi-LSTM
- Logistic Regression
- Linear SVM
- Naive Bayes
- XGBoost
Using the BERT Model
from transformers import pipeline
classifier = pipeline(
"text-classification",
model="Sudheer17/Sentiment/BERT"
)
result = classifier("I love this movie!")
print(result)
Example Output
[{'label': 'Positive', 'score': 0.9848}]
Example Inputs
I love this movie!
This is the worst experience ever.
The service was average.
Notes
- The BERT model can be loaded directly using the Hugging Face Transformers library.
- Classical Machine Learning and Deep Learning models are stored in their respective folders.
- Use the appropriate tokenizer and preprocessing pipeline when working with non-BERT models.
Requirements
transformers
torch
tensorflow
scikit-learn
joblib
numpy
pandas
Install them using:
pip install transformers torch tensorflow scikit-learn joblib numpy pandas
License
This repository is released under the MIT License.