This repository contains implementations of fundamental Artificial Intelligence and Deep Learning algorithms, developed during my coursework at the University of Wisconsin-Madison (CS 540: Introduction to AI).
The projects demonstrate my proficiency in PyTorch, Reinforcement Learning, and Adversarial Search, focusing on building models and agents from scratch to understand their underlying mechanics.
- Path:
computer_vision/lenet_cnn_classifier.py - Description: A manual implementation of the LeNet-5 Convolutional Neural Network architecture for image classification.
- Key Technical Features:
- Architecture Design: Constructed the network using
torch.nn.Module, defining Convolutional layers, Max Pooling, and Fully Connected layers. - Training Loop: Implemented the full optimization pipeline from scratch, including:
- Forward propagation
- Loss computation (CrossEntropyLoss)
- Manual gradient handling (
optimizer.zero_grad(),loss.backward(),optimizer.step()) to demonstrate understanding of Autograd.
- Dimensionality Management: Explicit handling of tensor shape transformations between convolutional and linear layers.
- Architecture Design: Constructed the network using
-
Path:
reinforcement_learning/rl_frozenlake_agent.py -
Description: An off-policy TD control agent trained to solve the gymnasium
FrozenLake-v1environment. -
Key Technical Features:
-
Q-Table Update: Implemented the core Bellman update equation:
$Q(s,a) \leftarrow (1-\alpha)Q(s,a) + \alpha(r + \gamma \max_{a'} Q(s',a'))$ . -
Exploration vs. Exploitation: Designed an
$\epsilon$ -greedy strategy with epsilon decay to balance exploring the environment and exploiting learned policies. - State-Action Mapping: Managed state-action pairs using Python dictionaries for efficient lookup.
-
Q-Table Update: Implemented the core Bellman update equation:
- Path:
search_algorithms/minimax_game_agent.py - Description: An adversarial AI agent capable of playing the strategy board game Teeko.
- Key Technical Features:
- Minimax Algorithm: Implemented a recursive depth-limited search to evaluate game states.
- Heuristic Evaluation: Designed a custom evaluation function that scores board states based on piece position, control of the center, and proximity to winning configurations (4-in-a-row).
- Successor Generation: Logic to handle different game phases (Drop Phase vs. Movement Phase).
- Languages: Python 3
- Deep Learning: PyTorch, Torchvision
- Reinforcement Learning: Gymnasium
- Scientific Computing: NumPy
- Version Control: Git
To run the Convolutional Neural Network training:
cd computer_vision
pip install -r requirements.txt
python lenet_cnn_classifier.pyTo train the Q-Learning agent:
cd reinforcement_learning
pip install -r requirements.txt
python rl_frozenlake_agent.py