Skip to content

corticalstack/ANNImdbClassifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

🎬 ANNImdbClassifier

A neural network-based classifier for IMDB movie reviews sentiment analysis using Keras.

📝 Description

ANNImdbClassifier is a Python implementation of a sentiment analysis model that classifies IMDB movie reviews as either positive or negative. The project uses a simple Artificial Neural Network (ANN) built with Keras to achieve this classification task.

✨ Features

  • Loads and preprocesses the IMDB dataset from Keras
  • Transforms text reviews into numerical vectors using one-hot encoding
  • Implements a sequential neural network with multiple dense layers
  • Visualizes training and validation metrics (loss and accuracy)
  • Provides a clean, object-oriented implementation

🔧 Prerequisites

  • Python 3.x
  • Keras
  • TensorFlow (backend for Keras)
  • NumPy
  • Matplotlib

🚀 Setup Guide

  1. Clone the repository:

    git clone https://github.com/corticalstack/ANNImdbClassifier.git
    cd ANNImdbClassifier
  2. Install the required dependencies:

    pip install tensorflow keras numpy matplotlib

💻 Usage

Simply run the main script:

python main.py

This will:

  1. Load the IMDB dataset
  2. Preprocess the data
  3. Build and train the neural network model
  4. Display training and validation metrics graphs

🏗️ Architecture

The classifier is implemented as a single class ImdbClassifier with the following methods:

  • __init__(): Initializes the classifier, loads and preprocesses data
  • build_model(): Creates and trains the neural network model
  • load_data(): Loads the IMDB dataset from Keras
  • decode_review(): Converts encoded reviews back to human-readable text
  • vectorize_sequences(): Transforms integer sequences into binary matrices

The neural network architecture consists of:

  • Input layer: Dense layer with 16 neurons and ReLU activation
  • Hidden layer: Dense layer with 16 neurons and ReLU activation
  • Output layer: Single neuron with sigmoid activation for binary classification

📊 Model Performance

The model visualizes both training and validation metrics:

  • Loss over epochs
  • Accuracy over epochs

These visualizations help in understanding the model's learning process and identifying potential overfitting.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🔗 Resources

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages