How a Neural Network Works: Neuron, Weights & Bias

Deep Learning with Keras and TensorFlow 11 min min read Updated: Nov 16, 2026 Beginner
How a Neural Network Works: Neuron, Weights & Bias
Beginner Topic 7 of 7

The Artificial Neuron

A neural network is built from simple units called neurons. A neuron takes some numbers in, mixes them and gives one number out.

Simple example: Imagine deciding whether to go for a picnic. You think about the weather, your free time and your friends. Weather is very important to you, free time a bit less. Each factor has an importance (weight), and you add them up. If the total is big enough, you go.

What a Neuron Does

  1. Take the inputs (x1, x2, x3 ...).
  2. Multiply each input by its weight (w1, w2, w3 ...).
  3. Add everything together, and add a bias (b).
  4. Pass the result through an activation function.
text output = activation( x1*w1 + x2*w2 + x3*w3 + b )
PartMeaning
Input (x)The data the neuron receives
Weight (w)How important each input is. This is what the network learns
Bias (b)A shift that helps the neuron fire more or less easily
ActivationA function that adds non-linearity, such as ReLU or sigmoid

A Numeric Example

python import numpy as np x = np.array([2.0, 3.0, 1.0]) # inputs w = np.array([0.5, -0.2, 0.8]) # weights b = 0.1 # bias z = np.dot(x, w) + b # 2*0.5 + 3*(-0.2) + 1*0.8 + 0.1 = 1.3 a = max(0, z) # ReLU activation print(z, a) # 1.3 1.3

Layers

Neurons are arranged in groups called layers.

LayerJob
Input layerReceives the raw data (for example 784 pixels)
Hidden layersDo the learning. 'Deep' means many hidden layers
Output layerGives the final answer (for example 10 digit probabilities)

Forward Pass in Keras

Sending data through the network from input to output is called the forward pass.

python import keras from keras import layers import numpy as np model = keras.Sequential([ keras.Input(shape=(3,)), layers.Dense(4, activation="relu"), # hidden layer: 4 neurons layers.Dense(1) # output layer: 1 neuron ]) sample = np.array([[2.0, 3.0, 1.0]]) print(model.predict(sample)) # some number, the weights are random

Right now the answer is meaningless because the weights are random. Learning means adjusting the weights until the answers become correct.

How Does the Network Learn? (Preview)

  1. Make a prediction (forward pass).
  2. Measure how wrong it is (the loss).
  3. Find which weights caused the mistake (backpropagation).
  4. Change the weights a little in the right direction (gradient descent).
  5. Repeat thousands of times.
Result

After many repetitions, the weights settle on values that give good predictions.

Conclusion

A neural network is just many simple neurons working together. Learning means finding good weights. In the next lessons you will learn about activations, loss and the learning algorithm.

Quick Summary: Neuron = inputs x weights + bias, then activation. Layers of neurons form a network, and learning means adjusting the weights.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators