🤖

Machine Learning

Machine learning is how modern software learns patterns from data instead of following hand-written rules — the technology behind spam filters, recommendation engines, self-driving perception and large language models. This hub pulls together the site's classical statistics, machine learning and neural-network simulations into one guided starting point, so you can watch each algorithm learn step by step instead of treating it as a black box.

16+ simulations Canvas 2D · Three.js · Gradient Descent

Simulations in this Topic

16 simulations across Machine Learning, AI & ML and Statistics

📈 ★★☆☆ Moderate
Linear Regression — OLS Least Squares
Fit a line to noisy data with ordinary least squares — drag points and watch the regression line and residuals update live.
Statistics
🧠 ★★★☆ Advanced
Perceptron
Rosenblatt's 1958 algorithm in action — each misclassified point tilts the weight vector until the line separates the classes.
Machine Learning
📉 ★★☆☆ Moderate
Gradient Descent Visualiser
Watch SGD, Momentum, RMSprop and Adam navigate a 3D loss landscape in real time and compare convergence speed.
AI & ML
🔁 ★★★★ Expert
Backpropagation
Watch the chain rule flow backward through a small network as weights update and the decision boundary morphs to fit the data.
Machine Learning
🧠 ★★★☆ Advanced
Neural Network — Backpropagation
A two-layer network trains live on XOR, circle or spiral boundaries — weights as edges, activations as node brightness.
Neural Networks
🎯 ★★☆☆ Moderate
K-Means Clustering
Step through k-means interactively — watch centroids converge, Voronoi regions update, and inertia (WCSS) decrease.
Machine Learning
🌌 ★★★☆ Advanced
DBSCAN — Density-Based Clustering
DBSCAN grows clusters from dense core points and labels sparse points as noise — finds arbitrary shapes, no cluster count needed.
Machine Learning
📊 ★★★☆ Advanced
k-Nearest Neighbours
Classify a point by majority vote among its k closest neighbours — see overfitting at k=1 and smoothing as k grows.
Machine Learning
📊 ★★☆☆ Moderate
Decision Tree Live
CART decision tree with Gini impurity splitting — watch recursive splits emerge level by level on XOR, Moons and Blobs.
Machine Learning
🌲 ★★★★ Expert
Random Forest Classifier
Watch bootstrap aggregation and random feature selection turn weak trees into a robust ensemble, with live OOB error.
Machine Learning
📊 ★★★☆ Advanced
Naive Bayes Classifier
Classify points with a Gaussian naive Bayes model — per-class means and variances, Bayes' rule, posterior decision boundary.
Machine Learning
📊 ★★★☆ Advanced
PCA and SVD Visualiser
Compute a covariance matrix, diagonalise it to find principal components, and see the SVD geometric decomposition live.
Machine Learning
🗺️ ★★★★★ Expert
t-SNE Visualiser
Watch t-SNE project high-dimensional clusters to 2D via gradient descent on the KL divergence between neighbour distributions.
Machine Learning
🎮 ★★★☆ Advanced
Reinforcement Learning
A Q-learning agent navigates an 8x8 grid maze — the heatmap shows Q-values, arrows show the greedy policy as it learns.
Machine Learning
🧠 ★★☆☆ Moderate
Convolutional Neural Network
Visualise CNN layers step by step — convolution filters, ReLU activations and max-pooling as a filter scans an image.
AI & ML
🗺️ ★★★☆ Advanced
Self-Organising Map
A 24x24 Kohonen SOM trained on RGB colour input, with Gaussian neighbourhood updates and exponential decay of learning rate.
Machine Learning

Suggested Learning Path

Six simulations, in the order we recommend exploring them

  1. 1
    1. Linear Regression

    Start with the simplest model in machine learning: fitting a line minimises squared error — every later model is a generalisation of this idea.

  2. 2
    2. Perceptron

    See the first learning algorithm for classification, and why a single linear unit fails on problems like XOR.

  3. 3
    3. Gradient Descent Visualiser

    Learn the optimisation engine that trains almost every model on this list — compare SGD, Momentum, RMSprop and Adam directly.

  4. 4
    4. Backpropagation

    Combine gradient descent with the chain rule to train a multi-layer network — the algorithm behind every deep learning system.

  5. 5
    5. K-Means Clustering

    Switch from supervised to unsupervised learning — group unlabelled data by proximity alone.

  6. 6
    6. Reinforcement Learning

    Finish with a third learning paradigm: an agent that learns from trial, error and reward rather than labelled examples.

Related Articles

The theory and maths behind the simulations above

What Is Machine Learning? A Complete Guide
A clear guide to supervised, unsupervised and reinforcement learning, with the bias-variance tradeoff and overfitting.
Machine Learning: From Linear Regression to Deep Learning
The mathematical foundations of modern AI — bias-variance tradeoff, regularisation, CNNs, RNNs and attention mechanisms.
Gradient Descent and Modern Optimisers: Adam, RMSprop, Momentum
Gradient descent is the optimisation engine behind deep learning — how momentum, RMSprop and Adam accelerate training.
Backpropagation: the Chain Rule Unwrapped
Computational graphs, forward and backward passes, Jacobians, vanishing gradients and a minimal autograd engine.
K-Means and DBSCAN Clustering
Clustering algorithms compared — K-Means EM iteration, DBSCAN density-reachability, inertia versus silhouette.
Reinforcement Learning Explained: Q-Learning and DQN
Agent, environment, reward, policy, Q-values, the Bellman equation, Q-learning and deep RL explained with CartPole.

About the Machine Learning Topic

From linear regression to reinforcement learning — a complete map of the topic

Machine learning is the family of methods that let a computer improve at a task from data rather than from a fixed set of hand-written rules. Instead of programming every decision explicitly, you show a model examples and let an optimisation algorithm adjust its internal parameters until its predictions match reality closely enough. This hub gathers every machine learning simulation on mysimulator.uk into one guided starting point, spanning three interconnected categories — classical statistics, hands-on machine learning algorithms, and the neural-network side of AI — so you can see exactly how a model learns rather than treating it as a black box.

The foundation is supervised learning, where a model is trained on labelled examples. Linear regression is the simplest case: fit a straight line to noisy data by minimising squared error, and every more sophisticated model — from the perceptron to a deep neural network — generalises this same idea. The perceptron simulation shows the first working classification algorithm from 1958, nudging a weight vector after every misclassified point until it separates two classes with a straight line, and famously failing on problems like XOR that no single linear boundary can solve. Decision trees, random forests, k-nearest neighbours and naive Bayes each attack classification with a different strategy — splitting on the most informative feature, voting among many trees, voting among nearby points, or applying Bayes' rule — and comparing them side by side makes their trade-offs concrete.

Gradient descent is the optimisation engine underneath almost all of these models: adjust each parameter in the direction that reduces error, repeat thousands of times. The gradient descent visualiser lets you compare plain stochastic gradient descent against Momentum, RMSprop and Adam on the same 3D loss landscape, showing directly why modern optimisers converge faster and escape shallow local minima that trap simpler methods. Backpropagation extends the same idea to multi-layer neural networks by applying the chain rule layer by layer, computing how a change deep inside the network affects the final error — the algorithm that makes training deep learning models computationally feasible at all.

Not every problem comes with labelled answers. Unsupervised learning finds structure in raw data on its own: k-means and DBSCAN both group similar points into clusters, but by very different rules — k-means assumes round, evenly sized clusters and needs a chosen number of groups in advance, while DBSCAN grows clusters from dense regions and can find arbitrary shapes without knowing how many clusters exist beforehand. PCA and t-SNE take a different unsupervised approach, compressing high-dimensional data down to two or three dimensions you can actually plot and see, revealing structure that would otherwise be invisible. Reinforcement learning is a third paradigm again — a Q-learning agent explores a maze by trial and error, updating value estimates from the rewards it receives rather than from any labelled dataset at all.

Follow the learning path below for a recommended order through the three learning paradigms — supervised, unsupervised and reinforcement — or browse the full grid of simulations and jump into whichever algorithm you are currently studying or curious about.

Every simulation here trains a real model on real data inside the browser tab, rather than replaying a pre-computed animation. The backpropagation simulation genuinely runs forward and backward passes through a small network and updates its weights after each one, so the decision boundary you see morphing is the model actually fitting the data in front of you — pause it, change the learning rate, and the next update reflects that change immediately. The random forest simulation genuinely bootstraps different subsets of the data and different subsets of features for each of its trees, which is why you can watch a single overfit tree's jagged decision boundary smooth out into the ensemble's more reliable one as more trees are added. That fidelity matters whether you are a student trying to build intuition before an exam, an engineer refreshing the mechanics behind a library you use daily, or an educator who wants a live demonstration where every slider genuinely changes the underlying computation rather than just the illustration.

These same building blocks scale up directly into production systems: the linear regression here is the same least-squares fit behind pricing and forecasting models; the decision trees and random forests here are the same algorithms behind fraud detection and credit scoring; the backpropagation here is the same chain-rule computation, run on far larger networks with far more data, that trains the large language models and image generators in daily use. Reinforcement learning's Q-learning maze is a simplified relative of the algorithms that learned to play Go and Atari games from scratch, and the same reward-driven trial-and-error loop underlies modern robotics control and recommendation systems. Working through this hub end to end gives you a working mental model of every major branch of machine learning, in an order that mirrors how the field itself developed — a solid foundation whether you are preparing for a course, an interview, or simply want to understand the technology behind the tools you use every day.

Frequently Asked Questions

Common questions about machine learning

What is the difference between machine learning and AI?
Artificial intelligence is the broad goal of building systems that perform tasks requiring intelligence. Machine learning is the dominant modern approach to AI: instead of hand-coding rules, a model learns patterns directly from data. Deep learning (neural networks) is in turn a subset of machine learning.
What is the difference between supervised, unsupervised and reinforcement learning?
Supervised learning trains on labelled input-output pairs (like linear regression or a decision tree). Unsupervised learning finds structure in unlabelled data alone (like k-means clustering or PCA). Reinforcement learning trains an agent through trial and error using rewards, with no labelled dataset at all (like the Q-learning maze simulation).
Why does gradient descent need momentum or Adam instead of a fixed learning rate?
Plain gradient descent can oscillate across narrow valleys in the loss landscape or get stuck on flat plateaus. Momentum smooths the path by averaging past gradients; Adam adapts the learning rate per parameter using estimates of both the gradient and its variance, which is why it usually converges faster and more reliably.
How is backpropagation different from gradient descent?
Gradient descent is the general optimisation rule: move parameters opposite to the gradient of the loss. Backpropagation is the specific, efficient algorithm for computing that gradient in a multi-layer neural network, by applying the chain rule backward from the output layer to the input layer.

Other Topic Hubs

Every simulation in this hub runs entirely in your browser, with no installation required. Use each interactive model to experiment with weights, gradients, clusters and rewards, then learn machine learning online at your own pace by tweaking parameters and watching the algorithm converge.