🏛️ Westminster College, London | wcc.co.uk

🤖 AI & Machine Learning · Complete Course Notes

🗓️ 6 Saturdays | 4pm–6pm 🎯 Beginner → Advanced 💻 Online · Live + Hands‑on
Master AI/ML from fundamentals to production: Python, scikit‑learn, neural networks, CNNs, NLP, Transformers, generative AI, and MLOps. Theory, practical code (TensorFlow/Keras, PyTorch, Gradio), and a full capstone project.
🐍 Module 1 — Python for Data Science & Classical ML Week 1 · 2h

📚 Python Ecosystem: NumPy, pandas, matplotlib

NumPy provides N‑dimensional arrays and vectorised operations. pandas handles tabular data (DataFrame). matplotlib/seaborn for visualisation. scikit‑learn offers classical ML algorithms, preprocessing, and model evaluation.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score

df = pd.read_csv('data.csv')
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
model = LogisticRegression()
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
print(accuracy_score(y_test, y_pred))

📊 Linear/Logistic Regression & Decision Trees

Linear regression models continuous outcomes; logistic regression for binary classification (sigmoid function). Decision trees split data based on feature thresholds (Gini/entropy). Model evaluation: accuracy, precision, recall, F1, confusion matrix, RMSE. Cross‑validation and hyperparameter tuning (GridSearchCV).
💡 Hands‑on: Build a classification model on the Iris dataset using scikit‑learn. Evaluate with confusion matrix and ROC‑AUC.
🧠 Module 2 — Neural Networks & Deep Learning Week 2 · 2h

⚙️ Perceptron to Multi‑Layer Perceptron (MLP)

A single perceptron is a linear classifier. MLP adds hidden layers and non‑linear activations (ReLU, sigmoid, tanh). Forward propagation: compute output layer by layer. Backpropagation uses chain rule to compute gradients, updating weights via gradient descent. Optimisers: SGD, Adam, RMSprop. Loss functions: cross‑entropy (classification), MSE (regression).
import tensorflow as tf
from tensorflow.keras import layers, models
model = models.Sequential([
layers.Dense(128, activation='relu', input_shape=(784,)),
layers.Dropout(0.2),
layers.Dense(64, activation='relu'),
layers.Dense(10, activation='softmax')
])
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
model.fit(X_train, y_train, epochs=10, batch_size=32, validation_split=0.2)

📦 MNIST Classification with MLP

MNIST: 28×28 grayscale digits (0‑9). Flatten to 784 vector. Build MLP with 2‑3 hidden layers. Use tf.keras.datasets.mnist. Normalise pixel values to [0,1]. Achieve >98% accuracy.
🖼️ Module 3 — Computer Vision with CNNs Week 3 · 2h

🔍 Convolutional Neural Networks (CNNs)

CNNs preserve spatial structure: convolution layers extract features (edges, textures), pooling (max/average) reduces dimensions. Popular architectures: LeNet, AlexNet, VGG, ResNet (residual connections enable deeper networks). Transfer learning: fine‑tune pre‑trained models (ResNet50, EfficientNet) on custom datasets.
from tensorflow.keras.applications import ResNet50
base_model = ResNet50(weights='imagenet', include_top=False, input_shape=(224,224,3))
base_model.trainable = False # freeze
model = models.Sequential([
base_model,
layers.GlobalAveragePooling2D(),
layers.Dense(128, activation='relu'),
layers.Dense(num_classes, activation='softmax')
])
# Data augmentation
datagen = tf.keras.preprocessing.image.ImageDataGenerator(
rotation_range=20, width_shift_range=0.2, height_shift_range=0.2, horizontal_flip=True)
📝 Module 4 — NLP with RNNs & Transformers Week 4 · 2h

🔤 Text Preprocessing & Sequence Models

Tokenisation (words/subwords), stemming, lemmatisation, stopwords removal. Word embeddings: Word2Vec, GloVe, or learned embedding layers. RNNs process sequences but suffer from vanishing gradients. LSTM/GRU use gating mechanisms to capture long‑range dependencies. Attention mechanism allows model to focus on relevant parts of input.
from tensorflow.keras.layers import Embedding, LSTM, Dense
model = models.Sequential([
Embedding(vocab_size, 128, input_length=max_len),
LSTM(64, return_sequences=True),
LSTM(32),
Dense(1, activation='sigmoid')
])
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])

🚀 Transformers & BERT

Transformer architecture (Vaswani et al., 2017) relies solely on self‑attention, enabling parallel processing and state‑of‑the‑art results. BERT (Bidirectional Encoder Representations from Transformers) pre‑trained on masked language modelling. Fine‑tune for tasks: classification, NER, QA. Use Hugging Face transformers library.
from transformers import BertTokenizer, TFBertForSequenceClassification
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
model = TFBertForSequenceClassification.from_pretrained('bert-base-uncased', num_labels=2)
# Tokenise and fine‑tune
🎨 Module 5 — Unsupervised Learning & Generative AI Week 5 · 2h

✨ Clustering & Dimensionality Reduction

K‑Means partitions data into k clusters (minimises inertia). Elbow method/silhouette score to choose k. PCA (Principal Component Analysis) reduces dimensions by projecting onto principal components (max variance). Used for visualisation and noise reduction.
from sklearn.cluster import KMeans
from sklearn.decomposition import PCA
kmeans = KMeans(n_clusters=3, random_state=42)
clusters = kmeans.fit_predict(X_scaled)
pca = PCA(n_components=2)
X_pca = pca.fit_transform(X_scaled)

🤖 Autoencoders & Generative Models (GANs)

Autoencoders learn compressed representations (encoder‑decoder) – used for denoising, anomaly detection. Generative Adversarial Networks (GANs): generator creates fake samples, discriminator tries to distinguish real vs fake. Train adversarially. Emerging models: VAEs, Diffusion models. Ethical considerations: deepfakes, bias, misuse.
# Simple autoencoder in Keras
input_img = layers.Input(shape=(784,))
encoded = layers.Dense(64, activation='relu')(input_img)
decoded = layers.Dense(784, activation='sigmoid')(encoded)
autoencoder = models.Model(input_img, decoded)
autoencoder.compile(optimizer='adam', loss='mse')
🚀 Module 6 — MLOps & Capstone Project Week 6 · 2h

⚙️ MLOps Lifecycle & MLflow

MLOps covers data versioning, model training, tracking, deployment, monitoring, and retraining. MLflow tracks experiments (parameters, metrics, models). Store models in model registry.
import mlflow
mlflow.set_experiment("text_classification")
with mlflow.start_run():
mlflow.log_param("learning_rate", 0.001)
mlflow.log_metric("accuracy", 0.94)
mlflow.tensorflow.log_model(model, "model")

📱 Deploy AI Apps with Gradio

Gradio builds interactive UIs for ML models with few lines of code. Supports image, text, audio inputs. Deploy on Hugging Face Spaces or as a standalone server.
import gradio as gr
def predict(image):
# preprocess, run model
return class_label
gr.Interface(fn=predict, inputs=gr.Image(), outputs=gr.Label()).launch()

🤝 Responsible AI & Model Monitoring

Fairness, explainability (SHAP, LIME), privacy (differential privacy). Monitor data drift, concept drift, and performance degradation. Automated retraining pipelines (e.g., with Kubeflow, Airflow).

🎓 Capstone Project: End‑to‑End AI/ML Application

Requirements:
  • Select a real‑world problem (classification, regression, vision, NLP, or generative).
  • Data collection and preprocessing.
  • Model building (classical ML, deep learning, or transfer learning).
  • Experiment tracking with MLflow.
  • Deploy a demo using Gradio or Streamlit.
  • Discuss ethical implications and limitations.
Example ideas: emotion recognition from text, image classifier for medical diagnosis, sentiment analysis on tweets, price prediction, or a style transfer app. Deliverables: GitHub repo with code, model, interactive demo link, and a final presentation (10 min).
🏆 Evaluation: Innovation, technical depth, deployment quality, documentation, and responsible AI considerations.