Skip to content

HumzaAwan/IMDB-Sentiment-Classification-using-BERT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 

Repository files navigation

IMDB-Sentiment-Classification-using-BERT

🧠 Project Overview

This project focuses on building a sentiment classification model using the IMDB movie review dataset.

βœ… Key Highlights

  • πŸ“Š Processed and cleaned 75,000 movie reviews to ensure high-quality input for training.
  • πŸ” Fine-tuned a Small BERT model with custom encoder layers and an optimized classification head.
  • βš™οΈ Enhanced performance using AdamW optimizer, learning rate tuning, and weight decay to improve generalization.
  • πŸ“ˆ Achieved 72% training accuracy and 75% validation accuracy, demonstrating effective model fine-tuning and deep learning optimization.

The project showcases the power of transfer learning in NLP using BERT and TensorFlow.

This project demonstrates fine-tuning a BERT model on the Stanford IMDB movie review dataset for binary sentiment classification (positive/negative). The model is built using TensorFlow, TensorFlow Hub, and TensorFlow Text.

πŸš€ Features

  • βœ… Downloads and preprocesses the IMDB dataset
  • βœ… Fine-tunes a Small BERT model (bert_en_uncased_L-4_H-512_A-8) from TensorFlow Hub
  • βœ… Splits data into training, validation, and test sets
  • βœ… Uses EarlyStopping and ModelCheckpoint callbacks
  • βœ… Saves the model in .h5, .keras, and TensorFlow SavedModel formats

πŸ“¦ Libraries Used

  • TensorFlow
  • TensorFlow Hub
  • TensorFlow Text
  • Keras

πŸ“ Dataset Structure

  • Training: pos, neg, and unsup
  • Test: pos, neg
  • Total files: ~100,000

🧠 Model Architecture

  • BERT encoder (trainable)
  • Dense(64) + Dropout(0.3)
  • Final sigmoid output for binary classification

🏁 How to Run

pip install tf-models-official tensorflow tensorflow_hub tensorflow_text

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published