YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
IMDb Sentiment Analyzer
A machine learning + deep learning project for sentiment analysis on the IMDb movie reviews dataset. This project compares classical ML models (Logistic Regression, SVM, Random Forest) with a fine-tuned DistilBERT transformer model. The web interface is built with Streamlit.
Website Link:
Features
- Train and use classical ML models (LogReg, SVM, RF).
- Fine-tuned DistilBERT model for state-of-the-art performance.
- Interactive Streamlit web app for real-time predictions.
- Model comparison dashboard with accuracy, precision, recall, and F1-score.
Screenshots
Repository Structure
IMDb-Sentiment-Analyzer/
βββ app.py # Streamlit app
βββ classical_models.py # Script to train classical models
βββ requirements.txt # Dependencies
βββ README.md # Project documentation
βββ IMDB Dataset.csv # Dataset
β
βββ models/
β βββ logreg_model.pkl
β βββ svm_model.pkl
β βββ rf_model.pkl
β βββ vectorizer.pkl
β
βββ sentiment_model/ # Fine-tuned DistilBERT
β βββ config.json
β βββ pytorch_model.bin
β βββ vocab.txt
β βββ ...
|
βββ images/ # Screenshots
β βββ Screenshot_1.png
β βββ Screenshot_2.png
β βββ Screenshot_3.png
β
βββ notebooks/
βββ dilbert.ipynb # Jupyter notebook for BERT fine-tuning
Models & Results
| Metric | Logistic Regression | SVM | Random Forest |
|---|---|---|---|
| Accuracy | 90.76% | 91.79% | 97.12% |
| Precision | 90.01% | 91.31% | 97.32% |
| Recall | 91.70% | 92.36% | 96.91% |
| F1-Score | 90.85% | 91.84% | 97.11% |
Installation
Clone the repository:
git lfs install git clone https://huggingface.co/Govind-Sankar/IMDb-Sentiment-Analyzer cd IMDb-Sentiment-AnalyzerInstall dependencies:
pip install -r requirements.txt
Usage
Run the Streamlit app:
streamlit run app.pyEnter a review and see the sentiment prediction.
Compare different models on metrics and visualizations.
Training
To retrain classical ML models:
python classical_models.pyThis will regenerate
.pklmodel files in/models/.To retrain DistilBERT: Open
notebooks/dilbert.ipynbin Jupyter/Colab and run all cells.
License
This project is licensed under the MIT License. See the LICENSE file for details.
MIT License
Copyright (c) 2025 Govind Sankar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


