Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

University AI Course

This repository contains the complete set of practical assignments developed for the Artificial Intelligence course at the university. The work covers a wide spectrum of machine learning and deep learning paradigms — from classical supervised learning and ensemble methods to generative models and recurrent neural networks for time-series forecasting.

Each assignment is structured as a fully functional Jupyter notebook, complete with data preprocessing, model implementation, hyperparameter optimisation, performance evaluation, and visualisation. Together, they demonstrate a solid command of the theoretical foundations and practical implementation skills required in modern AI.


Course Context & Learning Objectives

These assignments were designed to bridge the gap between theoretical AI concepts and hands-on implementation. The key learning outcomes addressed include:

  • Implementing and evaluating classic ML algorithms (KNN, SVM, Gradient Boosting, XGBoost).
  • Understanding and applying transfer learning and generative adversarial networks (GANs).
  • Mastering deep learning for time-series using RNNs, LSTMs, and GRUs.
  • Performing hyperparameter tuning, model interpretation, and feature importance analysis.
  • Working with real‑world datasets and image data.

Repository Structure

Notebook Topic Key Techniques
assignment1.ipynb Supervised Learning & Ensemble Methods KNN, SVM, Gradient Boosting, XGBoost, GridSearchCV, SHAP, Feature Importance
assignment2.ipynb Deep Learning for Vision – GANs & Transfer Learning DCGAN, VGG16, Transfer Learning, Data Augmentation, Fine‑tuning
assignment3.ipynb Time Series Forecasting with RNNs RNN, LSTM, GRU, Bidirectional RNNs, Early Stopping, Learning Rate Scheduling

Assignment 1 – Supervised Learning & Model Interpretation

Objective

Compare multiple classifiers on three benchmark datasets, optimise hyperparameters using cross‑validation, and interpret the best model using SHAP values.

Datasets

  • Iris – 3‑class flower classification (150 samples).
  • Titanic – binary survival prediction (891 samples, pre‑processed).
  • Telco Churn – binary customer churn prediction (7,043 samples).

Models & Implementation

  • K‑Nearest Neighbours (KNN): Tuned number of neighbours and distance metrics.
  • Support Vector Machine (SVM): Used RBF kernel; tuned C and gamma parameters via GridSearchCV.
  • Gradient Boosting: Built with GradientBoostingClassifier, optimised learning rate and tree depth.
  • XGBoost: The highlight of this assignment. Implemented with:
    • GridSearchCV over max_depth, learning_rate, reg_lambda, and scale_pos_weight (to handle class imbalance).
    • Early stopping and evaluation on validation set.
    • SHAP (SHapley Additive exPlanations): Generated beeswarm plots to identify the most influential features for churn prediction.

Results

  • Achieved >80% accuracy on Titanic and Telco churn; >95% on Iris.
  • SHAP analysis provided transparent, business‑ready insights into customer churn drivers.

Assignment 2 – Deep Learning for Vision Tasks

Part A – Generative Adversarial Network (GAN) on CIFAR‑10

  • Designed and trained a DCGAN (Deep Convolutional GAN) from scratch using Keras.
  • Generator: Built with Conv2DTranspose layers and LeakyReLU activations to upsample a 100‑dim latent vector into a 32×32 RGB image.
  • Discriminator: A CNN with dropout (0.4) and LeakyReLU to distinguish real from synthetic images.
  • Trained for 5 epochs with batch size 1024, showing stable convergence and realistic sample generation.

Part B – Transfer Learning for Binary Image Classification (Cats vs Dogs)

  • Leveraged a pre‑trained VGG16 (ImageNet weights) as a feature extractor.
  • Data augmentation (rotation, shift, shear, zoom, flip) was applied to the training set to mitigate overfitting.
  • Fine‑tuned the top layers with dense layers and dropout.
  • Achieved >90% validation accuracy in only 5 epochs, demonstrating the efficiency of transfer learning on small datasets.

Key Takeaways

  • Hands‑on experience with adversarial training dynamics.
  • Effective use of pre‑trained CNNs and data augmentation for limited‑data scenarios.

Assignment 3 – Time Series Forecasting with RNNs

Objective

Predict 72 future temperature readings (10‑minute intervals) given 216 past readings from the Jena Climate dataset.

Models Implemented

  • Simple RNN: Baseline model with 1–3 layers.
  • LSTM: Deep LSTM with dropout to handle long‑term dependencies.
  • GRU: Faster alternative to LSTM with comparable performance.
  • Bidirectional GRU (final model): Two bidirectional GRU layers with L2 regularisation and dropout.

Preprocessing Pipeline

  • Scaled data using MinMaxScaler.
  • Created sliding‑window sequences: 216 input → 72 output.
  • Split data 90‑10 into training and validation sets.

Optimisation

  • Used EarlyStopping to prevent overfitting.
  • Applied ReduceLROnPlateau for dynamic learning rate adjustment.
  • Final model achieved R² = 0.94 on the test set (a significant improvement over the baseline RNN which scored R² = 0.70).

Output

  • Plots comparing predictions against actual values.
  • Loss curves for training and validation sets.

Technical Stack

  • Language: Python 3.10+
  • Libraries: TensorFlow, Keras, Scikit‑learn, XGBoost, Pandas, NumPy, Matplotlib, Seaborn, SHAP, OpenCV
  • Environment: Jupyter Notebook, Google Colab

How to Run

  1. Clone this repository:

    git clone https://github.com/yourusername/ai-course-assignments.git
    cd ai-course-assignments
  2. Install required packages:

    pip install -r requirements.txt
  3. Launch Jupyter and open the desired assignment:

    jupyter notebook assignment1.ipynb

Note: Some datasets (e.g., skin lesion images, Jena climate CSV) are not included. Please download them separately and update file paths. The CIFAR‑10 dataset is built into Keras and loads automatically.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages