Skip to content

Collection of 3 CI projects: Neuroevolution with genetic algorithms for game AI, Fuzzy C-Means clustering, and neural network digit recognition on MNIST.

Notifications You must be signed in to change notification settings

zamirmehdi/Computational-Intelligence-Course

Repository files navigation

Computational Intelligence

Collection of three comprehensive projects exploring evolutionary algorithms, fuzzy logic, and neural networks from the Computational Intelligence course at Amirkabir University of Technology.

Python NumPy Pygame

📚 Table of Contents

📋 Overview

This repository contains three comprehensive projects completed during my undergraduate Computational Intelligence course at Amirkabir University of Technology. Each project demonstrates fundamental concepts in computational intelligence through practical, from-scratch implementations:

  1. Evolutionary AI Game - Neuroevolution using genetic algorithms for game-playing agents
  2. Fuzzy C-Means Clustering - Soft clustering with fuzzy logic and membership degrees
  3. Handwritten Digit Recognition - Multi-layer neural network with backpropagation on MNIST

All projects are accompanied by their respective codes, necessary datasets (if required), and comprehensive documentation, which includes instructions and reports (in Persian).

Course Focus:

  • Evolutionary computation and genetic algorithms
  • Fuzzy logic and soft computing
  • Neural networks and deep learning fundamentals
  • Optimization algorithms
  • Pattern recognition and classification

📚 Projects

1. Evolutionary AI Game

Neuroevolution system that trains neural networks to play games using genetic algorithms.

Description:

  • Implements genetic algorithms to evolve neural networks for game-playing agents
  • Three game modes: Helicopter, Gravity, and Thrust
  • Real-time visualization of evolutionary progress
  • Transfer learning capabilities across different game modes

Key Features:

  • Genetic Algorithm: (μ, λ) and (μ + λ) selection strategies
  • Neural Network: 3-layer feedforward architecture
  • Fitness Evaluation: Distance-based scoring system
  • Evolution Operators: Parent selection, crossover, and mutation
  • Advanced Features: Checkpointing, learning curves, transfer learning

Technologies: Python, Pygame, NumPy

📂 View Project Details


2. Fuzzy C-Means Clustering

Classification based on Fuzzy Logic (C-Means) for unsupervised data clustering.

Description:

  • Implements Fuzzy C-Means clustering algorithm from scratch
  • Soft clustering approach where data points have membership degrees to multiple clusters
  • Iterative optimization to minimize cost function
  • Tested on multiple datasets with visualization

Key Features:

  • Soft Clustering: Each data point belongs to multiple clusters with different degrees
  • Elbow Method: Automatic determination of optimal cluster count
  • Visualization: Color gradients showing fuzzy membership degrees
  • Multiple Datasets: Tested on 4 different datasets
  • Iterative Algorithm: Cost function minimization

Technologies: Python, NumPy, Pandas, Matplotlib

📂 View Project Repository


3. Handwritten Digit Recognition

Multi-layer neural network built from scratch to classify handwritten digits using the MNIST dataset.

Description:

  • Implemented a multi-layered neural network model from scratch
  • Trained to recognize and classify handwritten digits (0-9)
  • Uses backpropagation algorithm for training
  • No deep learning frameworks - pure NumPy implementation

Key Features:

  • Dataset: MNIST (60,000 training images + 10,000 test images)
  • Architecture: Multi-layer feedforward neural network
  • Training: Backpropagation with gradient descent
  • Implementation: Built from scratch without frameworks
  • Stages: Step-by-step implementation (step5, step6-1, step6-2, step6-3)

Technologies: Python, NumPy, Matplotlib, PIL (Pillow)

📂 View Project Repository

🗂️ Repository Structure

Computational-Intelligence-Course/
├── Evolutionary-AI-Game-Project/
│   ├── docs/
│   │   ├── Instruction.pdf          # Project specification (Persian)
│   │   └── Report.pdf               # Implementation report (Persian)
│   ├── src/
│   │   ├── game.py                  # Main game implementation
│   │   ├── player.py                # Player agent class
│   │   ├── evolution.py             # Genetic algorithm implementation
│   │   ├── nn.py                    # Neural network (feedforward)
│   │   ├── config.py                # Configuration settings
│   │   ├── util.py                  # Utility functions
│   │   └── box_list.py              # Obstacle management
│   └── checkpoint/                  # Saved evolution states
├── Fuzzy_C-means/                   # External repository (submodule)
└── Handwritten-Digit-Recognition/   # External repository (submodule)

🛠️ Technologies Used

Technology Purpose
Python 3.7+ Primary programming language
NumPy Numerical computing and matrix operations
Matplotlib Data visualization and plotting
Pygame Game development framework
Pandas Data manipulation and analysis
PIL/Pillow Image processing

🚀 Getting Started

Prerequisites

  • Python 3.7 or higher
  • pip package manager

Installation

  1. Clone the repository:
git clone https://github.com/zamirmehdi/Computational-Intelligence-Course.git
cd Computational-Intelligence-Course
  1. Install required packages:
pip install numpy matplotlib pandas pygame pillow

Running the Projects

Evolutionary AI Game:

cd Evolutionary-AI-Game-Project/src
python game.py --mode helicopter --play True

Fuzzy C-Means:

cd Fuzzy_C-means
python main.py

Handwritten Digit Recognition:

cd Handwritten-Digit-Recognition/src
python main.py

Detailed instructions are available in each project's directory.

ℹ️ Project Information

Author: Amirmehdi Zarrinnezhad
Course: Computational Intelligence
University: Amirkabir University of Technology (Tehran Polytechnic) - Spring 2021
Repository Link: Computational-Intelligence-Course

🔗 Related Courses

This repository is part of my coursework at Amirkabir University of Technology.

Other Course Projects:

📧 Contact

Questions or collaborations? Feel free to reach out!

📧 Email: amzarrinnezhad@gmail.com
🌐 GitHub: @zamirmehdi


(back to top)

If you found this project helpful, please consider giving it a star!

Amirmehdi Zarrinnezhad

Releases

No releases published

Packages

No packages published

Languages