MLP Forward & Backpropagation Simulator

Interactive visualization of neural network learning on Iris dataset

← Back

Simulation Steps

Color Legend

  • Blue — Forward signal
  • Orange — Gradient flow
  • Green — Active / Updated
  • Grey — Inactive (ReLU = 0)
  • Purple — Output layer

Step Explanation

Click a step button to begin visualization.

Configuration

  • Dataset: Iris
  • Architecture: 4 → 10 → 8 → 3
  • Optimizer: Adam
  • Learning Rate: 0.01
  • Epochs: 50
  • Hidden Activation: ReLU
  • Output Activation: Softmax

Understanding the MLP

Input Layer

Input features (sepal length, width, etc.) are normalized and fed into the network. Nodes pass values forward without computation.

Hidden Layers

Neurons compute a weighted sum of inputs plus bias: z = Σ(wᵢ·xᵢ) + b. This lets the network learn complex patterns.

Activation (ReLU)

ReLU clips negative values to zero: a = max(0, z). This non-linearity lets the network learn non-linear decision boundaries.

Backpropagation

Gradients computed layer by layer (right → left) using chain rule: ∂L/∂w = ∂L/∂ŷ × ∂ŷ/∂z × ∂z/∂w. Weights updated: w ← w − η·∂L/∂w.

Output (Softmax)

Converts raw scores into probabilities summing to 1. The class with the highest probability is the prediction.

Loss Function (MSE)

Mean Squared Error: L = (ŷ − y)². Measures how wrong the prediction is. Minimizing this over training drives the network to learn.