← AI-aktiviteter

Visualizing decision boundaries

Draw data points for two classes and see how different models draw the boundary between them.

🇸🇪 Svenska
Left-click = A · Right-click = B
Speed ½×
Class A
Class B
1
Choose a model
Linear model can only draw a straight decision boundary. See whether it manages to classify, for example, an XOR pattern.
2
Create data
Or click (Class A) and right-click (Class B) directly in the grid.
3
Train
Draw points to begin
4
Explore · click for an explanation
Decision boundary Classification Linear model
Neural network Hidden layer XOR
About the patterns
Activation function
tanh gives each neuron a value between −1 and +1. Train with both functions and compare the decision boundary – do you notice any difference in shape?
Activation function tanh vs ReLU
Look inside the network
Click Neurons to look at a single neuron, or click together your own combinations – see how simple pieces build the final boundary.
Neuron Combination
Architecture (neurons in the hidden layer)
Explore!

Switch the activation function and look closely at the decision boundary and at a single neuron. What happens to the shape? Then click together your own combinations of neurons under Neurons – see how each choice changes the boundary.

Visualizing decision boundaries

A classification model learns to draw a boundary between different categories. Explore what that boundary looks like and discover why a neural network is often needed.

1
Start with the linear pattern – Choose Linear model and press ▶ Train. Watch how a straight line separates the two classes!
2
Try another pattern – Switch, for example, to the XOR pattern in the right-hand menu and train with the same linear model again. What happens?
3
Add a hidden layer – Switch the model to Neural network and retrain. Watch the boundary bend and the points get classified correctly!
4
Go deeper – Open the Advanced tab and see how each individual neuron in the hidden layer splits the surface in its own way. It's the combination of all the neurons that creates the final decision boundary.

Advanced mode

Here you can analyze the model further.

1
Look inside the network – Click Neurons. Pick a single one to see how it splits the surface in its own way, or click together several to see how the final boundary emerges from the pieces you choose.
2
Activation function – Switch between tanh and ReLU and retrain. Look closely at the shape of the decision boundary – what's the difference?
3
Change the architecture – Adjust the number of neurons in the hidden layer. Here you can discover that more neurons give a more flexible boundary, but also slower training.