Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neural Network XOR - AI Learning Journey

A comprehensive repository documenting my exploration into Artificial Intelligence and Neural Networks during my final year of study. This project serves as both a learning resource and a practical implementation guide for various neural network architectures.

Project Overview

This repository transitioned? from implementing a simple XOR operation using neural networks into a more extensive study of deep learning Neural Network.., with a focus on EEG Signal Processing and Motor Imagery Classification using advanced architectures.

Project Journey

Phase 1: Logic Gate Solver for XOR Operation

The project began with building a simple Perceptron, to a Multi-Layer Perceptron (MLP) to solve the Exclusive OR (XOR) gate problem. This was chosen as a foundational exercise because it was:

  • Relatively simple to implement
  • Relatively easier to visualise mathematically, while demosntrating the nessesarry idea behind MLP and hidden layers
  • Provides a clear, measurable success criterion

Phase 2: Image Recognition Fundamentals

The scope expanded to tackle the MNIST dataset using MLPs. MNIST dataset, is regarded as the Hello World Of Artificial Intelligence, hence its neccessity in this problem space, but also, this was to explain the shortcomings of MLPs and the need to move towards more complex architectures, the core problem noted with MLPs is that:

  • MLPs require flattening images, losing spatial information
  • High dimensionality leads to inefficiency and overfitting
  • Introduced the need for specialized architectures for computer vision

This phase built upon concepts from a prior module on Digital Signal Processing (DSP), which provided essential background in signal manipulation. For a deeper exploration of DSP techniques, see the related repository: Signals-Pamphile

Phase 3: Advanced Deep Learning

Progressed through CNNs, RNNs, LSTMs, and hybrid architectures, ultimately focusing on:

  • EEG Signal Processing: Real-world biomedical signal analysis
  • Motor Imagery Classification: Using brain signals to classify motor intentions
  • Subject-Specific Adaptation: Tailoring models to individual neural patterns

Repository Structure

Neural-Network-XOR/
├── Assets/                              # Project media and trained models
│   ├── Media/                          # Visualizations and animations
│   │   ├── Convolution.gif
│   │   ├── Convolution.mov
│   │   ├── CSP_LDA_Confusion_Matrix.png
│   │   ├── MaxPooling.gif
│   │   └── MaxPooling.mov
│   └── Models/                         # Pre-trained models
│       ├── brain_tumor_cnn.pkl
│       ├── csp_model.joblib
│       ├── lda_model.joblib
│       ├── model.npz
│       └── model.txt
├── notebooks/                          # Jupyter Notebooks with all ExperimentationS
│   ├── CNN+LSTM.ipynb                  # Hybrid architecture exploration
│   ├── ConvolutionalNeuralNetwork.ipynb # CNN deep dive with visualizations
│   ├── RecurrentNeuralNetwork.ipynb    # RNN concepts and implementations
│   ├── Model.ipynb                     # Core MLP implementations
│   ├── Mnist_Test.ipynb                # MNIST dataset experiments
│   └── Preprocess_BCI.ipynb            # EEG preprocessing pipeline
├── src/                                # Code used for the EEG Headsets (Emotiv8)
│   ├── pipeline.py                     # Data preprocessing pipeline
│   └── test.py                         # Model evaluation & testing
├── requirements.txt
└── README.md

Key Components of the Project

1. Core Learning Path

Basic → Advanced Architecture Progression:

  • Model.ipynb: Implements basic MLP for XOR problem, demonstrating why hidden layers are essential
  • Mnist_Test.ipynb: Explores MLP limitations on image data, motivating the need for CNNs
  • ConvolutionalNeuralNetwork.ipynb: Deep exploration of convolutional operations with visualizations (Convolution.gif, MaxPooling.gif)
  • RecurrentNeuralNetwork.ipynb: Introduces sequence modeling for temporal data
  • CNN+LSTM.ipynb: Combines CNNs and LSTMs for complex signal processing
  • Preprocess_BCI.ipynb: Real-world EEG signal preprocessing and analysis

2. Pre-Trained Models

The Assets/Models/ directory contains trained models from different experiments:

  • CSP + LDA: Classical signal processing approach with confusion matrix visualization
  • CNN Model: Deep learning approach for image/signal classification
  • Brain Tumor CNN: Specialized CNN for medical imaging

3. Data Processing Pipeline

src/pipeline.py: Comprehensive preprocessing pipeline featuring:

  • EEG signal filtering and normalization
  • Artifact removal and noise reduction
  • Feature extraction techniques
  • Data augmentation strategies

src/test.py: Evaluation utilities including:

  • Model performance metrics
  • Confusion matrix generation
  • Cross-validation procedures
  • Subject-specific testing

Why XOR?

The XOR problem is a canonical example in neural networks because:

  • A single perceptron cannot solve it (demonstrates linear separability limits)
  • Requires at least one hidden layer (introduces the power of deep learning)
  • Provides immediate, intuitive feedback Last Updated: 2026-06-05

About

This repo has the Nueral Network which was trained to perform an XOR Operation on a 2 inputted array.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages