Skip to content

Latest commit

Β 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎬 Sentiment Analysis using Simple RNN

Deep Learning based Movie Review Sentiment Classification using TensorFlow, Keras & Streamlit



⭐ Predict whether an IMDB movie review is Positive or Negative using a Recurrent Neural Network.


πŸ“Œ Overview

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.


✨ Features

πŸ€– Deep Learning Model

  • Simple RNN Architecture
  • Word Embedding Layer
  • Binary Sentiment Classification
  • TensorFlow / Keras Implementation

🧠 NLP Pipeline

  • Text Preprocessing
  • Lowercase Conversion
  • Tokenization
  • Word Index Encoding
  • Sequence Padding
  • IMDB Dataset Vocabulary

🌐 Streamlit Application

  • Interactive UI
  • Real-time Prediction
  • Confidence Score
  • User-friendly Interface
  • Fast Inference

πŸ›  Tech Stack

Technology Purpose
Python Programming Language
TensorFlow Deep Learning
Keras Neural Network API
Streamlit Web Application
NumPy Numerical Computing
IMDB Dataset Movie Review Dataset

πŸ“‚ Project Structure

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

🧠 Model Architecture

                 Input Review
                       β”‚
                       β–Ό
               Text Preprocessing
                       β”‚
                       β–Ό
                 Word Encoding
                       β”‚
                       β–Ό
               Sequence Padding
                       β”‚
                       β–Ό
             Embedding Layer (128)
                       β”‚
                       β–Ό
            Simple RNN Layer (128)
                       β”‚
                       β–Ό
          Dense Layer (Sigmoid)
                       β”‚
                       β–Ό
       Positive / Negative Prediction

βš™ Model Summary

Layer Output Shape
Embedding (None, 500, 128)
SimpleRNN (None, 128)
Dense (None, 1)

Total Parameters: 1,313,027


πŸ“Š Dataset

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

πŸ”„ Workflow

Movie Review
      β”‚
      β–Ό
Text Cleaning
      β”‚
      β–Ό
Lowercase Conversion
      β”‚
      β–Ό
Tokenization
      β”‚
      β–Ό
Word Encoding
      β”‚
      β–Ό
Padding Sequences
      β”‚
      β–Ό
Embedding Layer
      β”‚
      β–Ό
Simple RNN
      β”‚
      β–Ό
Sigmoid Output
      β”‚
      β–Ό
Positive / Negative

πŸš€ Installation

Clone Repository

git clone https://github.com/Kirisaki00/Sentiment-Analysis-Simple-RNN-Project.git

Move into Project

cd Sentiment-Analysis-Simple-RNN-Project

Create Virtual Environment

python -m venv venv

Activate Environment

Windows

venv\Scripts\activate

Linux / macOS

source venv/bin/activate

Install Dependencies

pip install -r requirements.txt

Run Streamlit

streamlit run app.py

or

python -m streamlit run app.py

πŸ’» Usage

  1. Launch the Streamlit application.

  2. Enter a movie review.

Example:

This movie was absolutely amazing. The acting was incredible and the story kept me engaged throughout.
  1. Click Classify

  2. View

  • Sentiment
  • Prediction Score

πŸ“Έ Screenshots

🏠 Home Screen

image

πŸ“ˆ Prediction Result

image

πŸ“Š Sample Predictions

Review Prediction
This movie is amazing! 😊 Positive
Worst movie ever made. 😞 Negative
Fantastic acting and direction. 😊 Positive
Complete waste of time. 😞 Negative

πŸ“ˆ Future Improvements

  • πŸ”₯ LSTM Model
  • πŸš€ GRU Model
  • πŸ€– Transformer-based Sentiment Analysis
  • 🌍 Multi-language Support
  • πŸ“Š Attention Mechanism
  • ☁ Cloud Deployment
  • 🐳 Docker Support
  • πŸ”‘ User Authentication

🀝 Contributing

Contributions are always welcome!

  1. Fork the repository

  2. Create a feature branch

git checkout -b feature-name
  1. Commit changes
git commit -m "Added awesome feature"
  1. Push changes
git push origin feature-name
  1. Open a Pull Request

πŸ“œ License

This project is licensed under the MIT License.


πŸ‘¨β€πŸ’» Author

Anupam (Kirisaki)

GitHub

https://github.com/Kirisaki00


⭐ If you found this project useful...

Give this repository a ⭐

Made with ❀️ using TensorFlow, Keras & Streamlit

About

🎬 Deep Learning NLP project using TensorFlow, Keras & Streamlit to classify IMDB movie reviews as Positive or Negative using a Simple Recurrent Neural Network (RNN).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages