🧠

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

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²).

🔗
★★☆ 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