teacher
Sign in

Neural Networks

A neural network is layers of simple weighted sums followed by nonlinear functions, and stacking them lets it learn curved patterns.

30 min4 interactive

One neuron

A neuron in a neural network is a tiny function:

y=f(w1x1+w2x2+⋯+b)=f(w⋅x+b)y = f(w_1 x_1 + w_2 x_2 + \dots + b) = f(\mathbf{w} \cdot \mathbf{x} + b)

  • xx are the inputs (numbers from the data or from the previous layer).
  • ww are the weights: how much each input matters. bb is the bias: a constant shift.
  • ff is the activation function: a fixed nonlinear function applied to the weighted sum.

If ff is the sigmoid, this is exactly logistic regression. A neuron is the same idea you have already seen. The new part is connecting many of them.

Change the inputs, weights, bias and activation below. Notice how the output reacts to each.

A single neuronInputs × weights + bias → activation. Try sigmoid, tanh and ReLU.
1.0x1w=0.80.5x2w=-0.4bias 0.1sum0.70sigmoid0.67
1.0
0.5
0.8
-0.4
0.1
z = (0.8 x 1.0) + (-0.4 x 0.5) + 0.1 = 0.700output = sigmoid(z) = 0.668
z-66

A neuron multiplies each input by a weight, adds them up with a bias (z), then squashes z with an activation function. Sigmoid squeezes to 0..1, tanh to -1..1, ReLU keeps positives and zeroes negatives. Green lines are positive weights, red are negative.

Edit input
1 of 6