Free online tool

Neural Network Playground

Build a small neural network, press Play and watch it learn to separate the dots. Change the layers, neurons, activation and learning rate, then run the same network as Python code. Or paste your own table, train on it and ask the network for answers.

Use your own data

How to use it

  1. 1Choose the dataPick a problem: a shape, a real problem (rain, spam, taxi fare...) or your own table.
  2. 2Train the modelPress Play. The network trains and the loss goes down.
  3. 3Try a predictionTry a prediction: type new values under Output and read its answer.
  4. 4Experiment and compareChange the layers, neurons or learning rate and compare, then run the Python code.
Real problems (from easy to hard):
Enter your own problem

Pick a real problem to train on it at once, or keep a shape on the left to see how the network bends its boundary.

Epoch One epoch is one full pass over the training data. The counter shows how many passes the model has made. 000,000
The learning rate sets how big each weight update is. Too high and the loss jumps around without settling; too low and the model learns very slowly. 0.03 is a good start. Read the lesson →
The activation function turns a neuron's sum into its output and makes the model non-linear, so it can draw curves. Tanh gives -1 to 1, ReLU keeps positive values and turns negatives into 0, Sigmoid gives 0 to 1. With Linear, the boundary stays a straight line however many layers you add. Read the lesson →
How many examples the model looks at before it updates its weights once. Small batches update often but jump around; large batches are steadier but each step takes longer.

Press ▶ to start training. It stops by itself when the model stops improving.

Data

One group sits in the middle and the other forms a ring around it. No straight line can split them, so the model has to learn a closed curve.

Noise moves points away from their ideal place, so some cross into the other group's area, as in real data. The more noise, the harder it is to reach 100% accuracy. 0
The share of the data used for training. The rest is test data the model never learns from; it shows whether the model really works on new data. 50%

Network

A neuron is the smallest unit of the network. It takes its inputs, multiplies each by a weight, adds them up and passes the total through the activation function to give one number. Each circle in the diagram is a neuron. A layer is a column of neurons that all read the outputs of the layer before. Hidden layers sit between the inputs and the output. More layers let the model learn more complex boundaries, but training takes longer.
Features Output
Positive weightNegative weightFeatures Features are the values fed into the model. X1 and X2 are the point's coordinates; X1², X1X2, sin(X1) and the others are computed from them and help the model see the shape more easily. Click one to turn it on or off. Thicker line = bigger weight. Click a feature to turn it on or off.

Output

Train loss The loss measures how far predictions are from the right answers. Train loss is measured on data the model learned from, test loss on data it has never seen. Low train loss with high test loss means the model is memorising (overfitting). Read the lesson → 0.000
Test loss0.000

Loss over the epochstraintest

The loss curve appears once training starts.

Try a prediction

Type new input values. The answer changes as the network learns.

Answer -
Class +1Class -1Background = prediction

Enter your own problem

Paste a table with one row per example: the input columns first, the answer in the last column. Two labels (like yes / no) teach the network to classify; numbers (like prices) teach it to predict a value.

Not sure what to paste? Pick a real problem above the network: its table appears here and you can edit it.

This network in Python

The code follows your settings: the same data, features, layers, activation and learning rate. Run it to train the network in Python, or ask the AI to explain it.

Free to try without an account. Sign in for more AI help.

Ordinary programming vs a neural network

Same problem: from hours studied and hours slept, will a student pass? The two approaches solve it on completely different principles.

1Ordinary programming: you write the rule

The programmer has to understand the problem, work out a formula or a set of if/else conditions and write it as code. The computer does exactly what was written. It is clear and easy to check, but it only works when you know the rule.

rules.py Run this code
# Ordinary programming: the rule is written by hand
def predict(hours_studied, hours_slept):
    if 0.7 * hours_studied + 0.6 * hours_slept > 7.6:
        return "yes"
    return "no"

print(predict(8, 7))
print(predict(3, 6))

2Neural network: the computer finds the rule

You do not write the rule. You give the model many examples with the right answers, and during training it adjusts its weights until its predictions match them: it finds the rule itself. This suits problems whose rule is too complex to write down, such as recognising images, speech or spam.

neural_network.py Run this code
from sklearn.neural_network import MLPClassifier

# Examples: [hours_studied, hours_slept] and the real answer
X = [[6.9, 7.9], [0.9, 7], [9.1, 5.1], [6.6, 4.1], [9, 5.4], [2.5, 4.1], [2.7, 4.6], [2.5, 4.4], [4.1, 8.9], [2.2, 8.3], [5.1, 8], [6.4, 6.9], [6.1, 4], [3.5, 8.4], [8.3, 5.4], [3.5, 7.8], [0.8, 4.4], [2.5, 8.7], [9.5, 5.4], [8.5, 6.9], [5.4, 4.5], [1.6, 5.3], [0.8, 5.6], [4.1, 4.5]]
y = ["yes", "no", "yes", "no", "yes", "no", "no", "no", "no", "no", "yes", "yes", "no", "yes", "yes", "no", "no", "no", "yes", "yes", "no", "no", "no", "no"]

# The network finds the rule from the examples
model = MLPClassifier(hidden_layer_sizes=(4, 2), max_iter=3000, random_state=0)
model.fit(X, y)

print(model.predict([[8, 7], [3, 6]]))

The tool at the top of this page does the second thing: you watch the network find the rule in the data.

Try these experiments

Each one loads a setup. Press Play and watch what happens, then change one thing at a time.

How a neural network learns

Every epoch on this page runs the same three steps over the training dots.

1Forward passEach neuron multiplies its inputs by weights, adds a bias and passes the sum through the activation function. The output neuron gives a number between -1 and 1: blue or orange.
2LossThe loss measures how far the predictions are from the real colours. Here it is half the squared error, averaged over the dots. Lower is better.
3BackpropagationThe network works out how much each weight added to the loss and moves it a little the other way, scaled by the learning rate. One pass over the training data is one epoch.

Learn the ideas behind it

Short lessons with runnable Python for each idea you see on this page.

Frequently asked questions

What is a neural network playground?

A page where you build a small neural network and watch it train live, with nothing to install. Each dot is a training example, the background colour is what the network predicts for that spot, and the loss chart shows how wrong it still is.

How is this different from TensorFlow Playground?

The idea is the same: a small network trained live in the browser. This playground also writes your network as NumPy or PyTorch code that you can run and change in the Python editor, and the AI can explain the code line by line.

Why does my loss stop going down?

Usually the learning rate is too high (the loss jumps around) or too low (it barely moves), or the network is too small for the pattern. Try more neurons, another layer, or features such as X1 squared for the circle.

Do I need a GPU or Python installed?

No. The playground trains in your browser, and the Python code runs on our servers when you press Run this code.

What does Show a sharp boundary do?

It colours each spot fully blue or fully orange instead of showing how sure the network is, so you see the exact decision boundary.

Can I train it on my own data?

Yes. Paste a table (CSV, or copy cells from Excel or Google Sheets): the input columns first, the answer in the last column. Two labels such as yes / no make a classifier; numbers such as prices make a regression. Then type new inputs under Try a prediction to get its answer, and the Python code includes your data.