Machine learning coursework · 2023

ML Model Analysis

I used machine learning to classify tumours, recognise activities from sensor sequences and estimate demand for bike rentals.

Explore the exhibit

PCA and kernels

I standardised 30 Wisconsin breast cancer features, reduced them to two principal components and compared how well an SVM classified tumours with and without that reduction.

Scroll or swipe sideways · Arrow keys to scrub · Space to pause or resume

Wisconsin dataset · teaching fitPCA / SVM
Linear kernel
PC1 · 44.3% variancePC2 · 19%
RBF kernel
PC1 · 44.3% variancePC2 · 19%
Benign Malignant Decision boundary

Coursework result. My report records 96.6% accuracy for the two-component model and 97.3% with all 30 features. The plots compare linear and RBF boundaries fitted for this demo.

Activity recognition

I built a hidden Markov model to label walking, lying down, and sitting on a bed or chair from accelerometer and radio readings. The model used the order of the readings to infer a sequence of activities.

Scroll or swipe sideways · Arrow keys to scrub · Space to pause or resume

Simulated sensor sequenceLying down
SensorreadingLying downSit on bedSit on chairWalkingTime →

Coursework result. The model reached 92.9% accuracy on held-out sensor sequences. In this simplified example, the highlighted spike looks like a step on its own. The surrounding readings keep the decoded activity at sitting on the bed.

Bayesian regression

I fitted a Bayesian linear model in PyMC to Seoul bike rental counts using time of day and weather. I sampled the posterior to estimate how each input related to demand and how uncertain those estimates were.

Scroll or swipe sideways · Arrow keys to scrub · Space to pause or resume

Bayesian fit · toy data0 observations

Shading: 95% credible band for the mean

Coursework result. The fitted model associated warmer temperatures with more rentals and rain with fewer. The remaining error was high, so I judged the linear model a poor fit for predicting demand. This plot uses synthetic data to show how observations update the fit.