🧠

Machine Learning & Neural Networks

Gradient descent, backpropagation, attention heads — the algorithms powering modern AI, stripped down to their mathematical cores and made interactive. Train networks, visualise loss landscapes, and watch agents learn.

5 simulations Canvas 2D · WebGL Backprop · Perceptron · GA

Category Simulations

Interactive learning algorithms — from perceptron to transformer

Machine learning is the field that lets computers improve at a task by learning patterns from data rather than following hand-written rules. This category turns that idea into something you can see and touch: train a neural network, watch backpropagation push gradients backwards through the layers, follow centroids settle during k-means clustering, and observe a reinforcement-learning agent discover a winning strategy through trial and error. Along the way you build a working intuition for gradient descent, decision boundaries, overfitting, and the difference between supervised and unsupervised learning. It matters because the same algorithms power everything from recommendation engines and fraud detection to medical imaging and the large language models behind modern AI — understanding how they learn is the foundation for building and trusting them.

All modern AI is differentiable function composition. A neural network is a parameterised function f(x; θ). Training minimises a loss L(θ) via gradient descent: θ ← θ − α ∇L. Backpropagation is the chain rule applied efficiently — O(forward pass) instead of O(parameters²).

🎯
New ★★★ Advanced
K-Means Clustering
Cluster 2D points with k-means: assign each to its nearest centroid, move centroids to the mean, repeat.
k-means clustering Lloyd
🌌
New ★★★ Advanced
DBSCAN
DBSCAN grows clusters from dense core points using ε-neighbourhoods and minPts, labelling sparse points as noise.
DBSCAN density clustering core points
📊
New ★★★ Advanced
Naive Bayes Classifier
Classify 2D points with a Gaussian naive Bayes model: estimate per-class means and variances, apply Bayes' rule under the independence assumption,…
naive Bayes classification Gaussian
🗺️
★★★ Advanced New
t-SNE Visualiser
Watch t-SNE project high-dimensional clusters to 2D: Gaussian affinities in high-D, Student-t in 2D, gradient descent on KL(P‖Q). Tune perplexity and see clusters separate.
t-SNEDimensionality ReductionKL DivergenceCanvas 2D
🌲
★★★ Advanced New
Random Forest Classifier
Watch bootstrap aggregating and random feature selection turn weak decision trees into a robust ensemble. Compare a single overfit tree to a 50-tree forest, with a live decision boundary, OOB error and feature importances.
Random Forest Ensemble Bagging Canvas 2D
🔁
★★★ Advanced
Backpropagation — Gradients Through an MLP
Watch the chain rule flow backward through a small MLP. δ pulses pulse right-to-left, gradients highlight edges, weights update — and the decision boundary on the input plane morphs to fit the data.
Canvas 2D Backprop Chain Rule MLP
📊
★★★ Advanced
k-Nearest Neighbours
Classify a point by majority vote among its k closest labelled neighbours. Decision regions update live as you change k, distance metric or data — see overfitting at k=1 and smoothing as k grows.
Canvas 2D k-NN Supervised Classifier
🧠
★★★ Advanced
Perceptron — Original Learning Algorithm
Rosenblatt's 1958 algorithm in action: each misclassified point tilts the weight vector by w ← w + η·y·x. The line converges on linearly separable data — and famously fails on XOR.
Canvas 2D Perceptron Linear Classifier Rosenblatt
🔗
★★☆ Moderate
Neural Network Visualiser
Build a fully-connected network layer by layer. Train it on XOR, spiral and circle datasets. Watch weight matrices update, activations flow forward, and gradients backpropagate — all animated per epoch.
Canvas 2D Backpropagation SGD ReLU / Sigmoid
🔀
★★☆ Moderate
Genetic Algorithm
Evolution as optimisation: a population of candidate solutions evolves toward a fitness target via selection, crossover and mutation. Plot fitness distributions and observe convergence or premature diversity loss.
Canvas 2D Evolutionary Crossover Mutation
🎮
★★★ Advanced
Reinforcement Learning
Q-learning agent navigates a grid-world with rewards and penalties. Watch the Q-table build up step by step; visualise the greedy policy as an arrow map. Tune ε, α and γ live.
Canvas 2D Q-Learning Bellman Equation
🗺️
★★★ Advanced
Self-Organising Map
Unsupervised 2D lattice that learns to map high-dimensional data to a 2D neighbourhood-preserving topology. Watch 576 neurons self-organise into a colour gradient — topology preserved.
Canvas 2D Unsupervised Topology
📊
★★☆ Moderate
Decision Tree Live
CART splits a 2D dataset by Gini impurity. Watch axis-aligned decision boundaries emerge level by level as max depth grows from 0 to 8.
Canvas 2D CART Gini Impurity
🎯
Ready ★★☆ Moderate
K-Means Clustering
Step through k-means interactively: place points or pick a dataset, choose k 1–8, and watch centroids converge. Voronoi regions update each iteration and the WCSS inertia chart shows convergence.
Clustering Voronoi WCSS Unsupervised

Key Concepts

The mathematics of learning from data

Backpropagation
Reverse-mode automatic differentiation. Forward pass computes activations and caches them. Backward pass applies chain rule right-to-left: δL/δwᵢⱼ = δL/δaⱼ · aᵢ. Cost O(forward pass) — the reason deep learning is tractable. Vanishing gradients in deep sigmoid nets → ReLU / residual connections.
Gradient Descent
θ ← θ − α ∇_θ L(θ). Batch GD uses full dataset each step — stable, slow. SGD uses one sample — noisy, fast. Mini-batch is the practical compromise. Momentum, RMSProp, Adam add adaptive learning rates. Learning rate schedule: warm-up then cosine decay.
Universal Approximation
A single-hidden-layer network with enough neurons can approximate any continuous function on a compact domain to arbitrary precision. Depth buys exponential representation efficiency — deep networks need fewer parameters than wide ones for most functions. Width without depth limits expressivity.
Q-Learning
Q(s,a) ← Q(s,a) + α[r + γ max_a' Q(s',a') − Q(s,a)]. Bellman update: current Q = reward + discounted future best Q. Off-policy: learn optimal Q while following ε-greedy exploration. Convergence guaranteed for tabular finite MDPs. DQN replaces the table with a neural network.

Learning Resources

Articles and tutorials about machine learning

About Machine Learning Simulations

Neural networks, training, optimization, and AI explained visually

Machine learning simulations make the abstract mechanics of AI visible and interactive. A fully-connected neural network is displayed as a live graph where you watch weights update and loss decrease during backpropagation training. Genetic algorithm visualisers evolve populations of candidate solutions, showing selection pressure, crossover, and mutation changing the gene pool generation by generation.

Pattern recognition demos train on simple datasets (XOR, MNIST digits, spiral classification) so you can change learning rate, hidden layer size, or activation function and immediately see how training dynamics and decision boundaries respond. These interactive experiments build the intuition that textbooks and lecture slides cannot — making the behaviour of gradient descent, overfitting, and local minima concrete before diving into production frameworks.

Machine learning simulations make the mathematics of AI transparent. Gradient descent — the optimisation algorithm behind every neural network from GPT to AlphaFold — is just calculus on a high-dimensional landscape. Watching the loss surface and decision boundaries update in real time makes abstract concepts like overfitting, regularisation, and the vanishing gradient problem immediately intuitive. These tools are invaluable for students and practitioners alike.

Key Concepts

Topics and algorithms you'll explore in this category

BackpropagationChain-rule gradient descent through layers
Gradient DescentIterative minimisation of a loss function
Convolutional NetsFeature detection via learned spatial filters
Reinforcement LearningAgent-environment reward maximisation
K-Means ClusteringIterative centroid-based partitioning
Decision BoundariesHyperplanes learned by classifiers

Frequently Asked Questions

Common questions about this simulation category

How does the neural network learn in the simulation?
Weights are updated by stochastic gradient descent with backpropagation. Each forward pass computes predictions; the loss (cross-entropy or MSE) is back-propagated through the network using the chain rule to compute gradients, which are used to nudge weights in the direction that reduces loss.
What does the reinforcement learning simulation show?
An agent receives rewards for good actions and penalties for bad ones, learning a policy through Q-learning or policy gradient methods. You can watch the agent explore the environment, fail initially, and gradually develop an optimal strategy through trial and error.
Why do neural networks need many layers?
Deep networks learn hierarchical representations: early layers detect edges and colours, middle layers detect shapes and textures, and deep layers detect high-level concepts. Each layer composes the features of the previous layer, enabling exponentially more expressive representations with each added depth.

Other Categories

Every Machine Learning simulation on this page runs in your browser so you can learn Machine Learning online without installing frameworks or configuring a GPU. Each interactive Machine Learning model lets you adjust the learning rate, dataset and architecture and instantly see how training dynamics and decision boundaries respond. From backpropagation and gradient descent to k-means clustering and Q-learning, these hands-on tools build the intuition behind real-world applications such as fraud detection, medical image analysis and recommendation systems — making abstract AI mathematics concrete, visual and genuinely understandable.