A collection of projects from my Introduction to Artificial Intelligence course, covering multi-armed bandits, Markov decision processes, and neural network classifiers.
Implementation of the multi-armed bandit problem using Thompson Sampling with Dirichlet priors. Features social learning from other agents' choices and Monte Carlo simulation methods.
Key files:
bandit.py- Thompson Sampling with Dirichlet priorsNewBandit.py- Information-Directed Sampling (IDS) for optimal exploration-exploitationBayesUCB.py- Bayesian Upper Confidence Bound implementationmonte_carlo.py- Monte Carlo simulation methodssimulator.py- Bandit simulation environment
A Markov Decision Process (MDP) solution to the classic water bucket problem. Given three buckets of different capacities, the goal is to find the optimal policy for reaching a target water level through fill, empty, and pour actions.
Key files:
buckets_mdp.py- MDP implementation with value iteration
An MDP-based Blackjack solver with both infinite-deck analysis and finite-deck card counting. Uses policy iteration to compute optimal hit/stand decisions and includes an interactive tournament agent for live play assistance.
Features:
- Policy iteration for computing optimal strategy
- Adaptive MDP that recomputes optimal play based on remaining cards
- Card counting with exact deck tracking
- Monte Carlo simulation for strategy comparison (basic vs adaptive vs Hi-Lo counting)
- Tournament configuration with rank removal (e.g., no 5s)
Key files:
blackjack_mdp.py- Infinite-deck MDP with policy iterationblackjack_game.py- Core game logic and hand evaluationadaptive_mdp.py- Finite-deck MDP that adapts to deck compositionfinite_deck_tracker.py- Exact card counting and probability trackingtournament_agent.py- Interactive CLI for live tournament playmonte_carlo_simulator.py- Strategy comparison via simulation
Usage:
# Compute optimal strategy for infinite deck
python blackjack_mdp.py
# Run interactive tournament agent
python tournament_agent.py
# Compare strategies via Monte Carlo simulation
python monte_carlo_simulator.pyImage classification using three progressively complex neural network architectures:
- Single Perceptron - Basic linear classifier
- Multi-Layer Perceptron (MLP) - Feedforward neural network
- Convolutional Neural Network (CNN) - Deep learning approach
Supports GPU acceleration on M1 Macs via Metal.
Key files:
classifier1_perceptron.py- Single perceptron classifierclassifier2_mlp.py- MLP classifierclassifier3_cnn.py- CNN classifier
Usage:
# Train a model
python classifier2_mlp.py --train --epochs 50 --gpu
# Classify images
python classifier2_mlp.py -d [image_directory]