Skip to content

Code playground for commonly used machine learning models and algorithms

Notifications You must be signed in to change notification settings

olibridge01/PlaygroundML

Repository files navigation

Python3.10
Python NumPy scikit-learn PyTorch

PlaygroundML_grey

Playground for Machine Learning in Python

PlaygroundML is a repository containing implementations of various commonly used machine learning models and algorithms. I wrote this project with the aim of elucidating some key methods in machine learning and understanding how things work in practice. Feel free to play around with my code or use it for reference.

Installation

To clone the repository and install the required packages, run the following commands in the terminal:

git clone https://github.com/olibridge01/PlaygroundML.git
cd PlaygroundML
pip install -r requirements.txt

Directory Structure

The repository is divided into directories corresponding to each ML algorithm/model that I have implemented. Each directory contains:

  • A Python file containing the implementation of the algorithm/model.
  • A Jupyter notebook containing a demonstration of the algorithm/model on a toy dataset, including relevant equations/background theory.
  • Any miscellaneous files (e.g. plots/gifs).

The directories are as follows:

  • 01-LinearRegression: Plain old linear regression, regression with a feature map $\mathbf{\phi}(\mathbf{x})$, and ridge regression ($L_2$ regulariser).
  • 02-kNearestNeighbours: $k$-NN algorithm for a two-dimensional toy dataset.
  • 03-KernelRidgeRegression: Kernel ridge regression with a Gaussian kernel, including cross-validation for hyperparameter determination.
  • 04-SupportVectorMachines: SVMs implemented on toy datasets (linearly separable, linearly nonseparable and nonlinearly separable).
  • 05-GaussianProcesses: Gaussian process regression on a toy dataset of noisy training data.
  • 06-GaussianMixtureModels: Gaussian mixture models implemented on a toy dataset.
  • 07-kMeansClustering: $k$-means clustering on toy data.

Visualisations

Below is a selection of plots generated by running my implementations on toy datasets. Where possible, I plot an animation to show how the algorithm behaves as it learns.

$k$-Nearest Neighbours Algorithm Gaussian Process Regression
First Image Second Image
EM Algorithm for Gaussian Mixture Model $k$-Means Clustering for $k=2$
First Image Second Image
$k$-Means Clustering for $k=5$ Placeholder
First Image Second Image

Oli Bridge (olibridge@rocketmail.com)

Feel free to explore the different directories, and please reach out if you have any questions or suggestions. 🚀

Releases

No releases published

Packages

No packages published