This project implements a Natural Language Processing (NLP) pipeline using a Simple Recurrent Neural Network (Simple RNN) to classify IMDB movie reviews into:
- π Positive Review
- π Negative Review
The application is deployed with Streamlit, allowing users to enter their own movie reviews and instantly receive sentiment predictions along with confidence scores.
- Simple RNN Architecture
- Word Embedding Layer
- Binary Sentiment Classification
- TensorFlow / Keras Implementation
- Text Preprocessing
- Lowercase Conversion
- Tokenization
- Word Index Encoding
- Sequence Padding
- IMDB Dataset Vocabulary
- Interactive UI
- Real-time Prediction
- Confidence Score
- User-friendly Interface
- Fast Inference
| Technology | Purpose |
|---|---|
| Python | Programming Language |
| TensorFlow | Deep Learning |
| Keras | Neural Network API |
| Streamlit | Web Application |
| NumPy | Numerical Computing |
| IMDB Dataset | Movie Review Dataset |
Sentiment-Analysis-Simple-RNN-Project/
β
βββ app.py # Streamlit Application
βββ embedding.ipynb # Word Embedding Experiments
βββ simplernn.ipynb # Model Training
βββ prediction.ipynb # Prediction Notebook
β
βββ simple_rnn_imdb.h5 # Trained Model
β
βββ requirements.txt
βββ README.md
Input Review
β
βΌ
Text Preprocessing
β
βΌ
Word Encoding
β
βΌ
Sequence Padding
β
βΌ
Embedding Layer (128)
β
βΌ
Simple RNN Layer (128)
β
βΌ
Dense Layer (Sigmoid)
β
βΌ
Positive / Negative Prediction
| Layer | Output Shape |
|---|---|
| Embedding | (None, 500, 128) |
| SimpleRNN | (None, 128) |
| Dense | (None, 1) |
Total Parameters: 1,313,027
Dataset Used:
IMDB Movie Reviews Dataset
Dataset Characteristics
- 50,000 Movie Reviews
- Binary Classification
- Positive Reviews
- Negative Reviews
- Pre-tokenized Vocabulary
- Maximum Vocabulary Size: 10,000 Words
Movie Review
β
βΌ
Text Cleaning
β
βΌ
Lowercase Conversion
β
βΌ
Tokenization
β
βΌ
Word Encoding
β
βΌ
Padding Sequences
β
βΌ
Embedding Layer
β
βΌ
Simple RNN
β
βΌ
Sigmoid Output
β
βΌ
Positive / Negative
Clone Repository
git clone https://github.com/Kirisaki00/Sentiment-Analysis-Simple-RNN-Project.gitMove into Project
cd Sentiment-Analysis-Simple-RNN-ProjectCreate Virtual Environment
python -m venv venvActivate Environment
venv\Scripts\activatesource venv/bin/activateInstall Dependencies
pip install -r requirements.txtRun Streamlit
streamlit run app.pyor
python -m streamlit run app.py-
Launch the Streamlit application.
-
Enter a movie review.
Example:
This movie was absolutely amazing. The acting was incredible and the story kept me engaged throughout.
-
Click Classify
-
View
- Sentiment
- Prediction Score
| Review | Prediction |
|---|---|
| This movie is amazing! | π Positive |
| Worst movie ever made. | π Negative |
| Fantastic acting and direction. | π Positive |
| Complete waste of time. | π Negative |
- π₯ LSTM Model
- π GRU Model
- π€ Transformer-based Sentiment Analysis
- π Multi-language Support
- π Attention Mechanism
- β Cloud Deployment
- π³ Docker Support
- π User Authentication
Contributions are always welcome!
-
Fork the repository
-
Create a feature branch
git checkout -b feature-name- Commit changes
git commit -m "Added awesome feature"- Push changes
git push origin feature-name- Open a Pull Request
This project is licensed under the MIT License.
GitHub