beginner22 min

Neural Network Intuition

How a neural network turns numbers into predictions, without the heavy math.

What you'll learn

  • Explain what a weight and a bias do in a single artificial neuron
  • Explain training as adjusting weights to reduce error, at a conceptual level
  • Trace a tiny numeric example through one neuron by hand

Prerequisites

Explanation

A neural network is built from many small, identical units called neurons, loosely inspired by (but much simpler than) biological neurons. A single artificial neuron does something surprisingly modest: it takes some numeric inputs, multiplies each by a weight, adds them up along with a bias, and passes the result through a simple function.

output = activation(input1 * weight1 + input2 * weight2 + ... + bias)

The weights control how much each input matters — a weight near zero means "mostly ignore this input," a large weight means "this input strongly influences the result." The bias shifts the result up or down regardless of the inputs, similar to the y-intercept in a line equation. The activation function (like ReLU or sigmoid) adds non-linearity so the network can represent more than straight-line relationships — without it, stacking many layers would collapse into the same power as a single layer.

A real network chains thousands to billions of these neurons across many layers: an input layer, one or more hidden layers, and an output layer. Each neuron's output feeds into the next layer's neurons as an input. The specific pattern the network can recognize emerges entirely from the numeric values of all its weights and biases.

Training is the process of finding good weight and bias values. You start with random weights (so the network's first outputs are essentially garbage), show it an example with a known correct answer, measure how wrong its output was (the error or loss), and nudge every weight slightly in the direction that would have reduced that error — repeated across millions of examples. This nudging algorithm is called gradient descent, and computing exactly how much to nudge each weight is called backpropagation. You don't need to hand-derive these to use modern AI tools, but knowing that "training" literally means "iteratively adjusting numbers to reduce error" demystifies a lot of what would otherwise feel like magic.

One neuron, one layer, many layers

A single neuron: inputs × weights, summed with a bias, passed through an activation function, producing one output. Stack many neurons into a layer; stack many layers to form a deep network, where each layer's outputs become the next layer's inputs.

Example

A single hand-computed 'neuron' with a ReLU-style activation.

function neuron(inputs, weights, bias) {
  let sum = bias;
  for (let i = 0; i < inputs.length; i++) {
    sum += inputs[i] * weights[i];
  }
  return Math.max(0, sum); // ReLU: negative results become 0
}

const inputs = [1.0, 0.5];
const weights = [0.8, -0.2];
const bias = 0.1;

console.log(neuron(inputs, weights, bias));

Try it yourself

Change the weights or bias and see how the neuron's output shifts.

Code editor. Press Escape then Tab to leave the editor if keyboard focus becomes trapped. Press Control+Shift+M inside the editor to toggle Tab-key focus trapping.

Loading editor…

Guided exercise

Guided exercise

Complete the function `weightedSum(inputs, weights, bias)` that returns the sum of each input times its matching weight, plus the bias (no activation function yet).

Checks: Weighted sum of two inputs is correct · plus 1 hidden check

Code editor. Press Escape then Tab to leave the editor if keyboard focus becomes trapped. Press Control+Shift+M inside the editor to toggle Tab-key focus trapping.

Loading editor…

Stuck? Get a hint.

Independent exercise

Independent exercise

Write a function `relu(x)` (returns x if positive, else 0) and a function `neuronOutput(inputs, weights, bias)` that computes the weighted sum plus bias and applies relu to it.

Checks: relu(-5) is 0 · relu(3) is 3 · plus 1 hidden check

Code editor. Press Escape then Tab to leave the editor if keyboard focus becomes trapped. Press Control+Shift+M inside the editor to toggle Tab-key focus trapping.

Loading editor…

Stuck? Get a hint.

Common mistakes

  • Thinking a neural network 'understands' concepts the way a person does, rather than approximating a numeric function.
  • Forgetting that without an activation function, stacking layers is mathematically no more powerful than a single layer.
  • Assuming training means writing rules — it means automatically adjusting numeric weights based on error.

Knowledge check

Knowledge check

1. What does a weight control in a neuron?
2. What is the purpose of an activation function like ReLU?
3. At a conceptual level, what does 'training' a neural network mean?

Takeaway

A neuron is just a weighted sum plus bias run through a simple function — the 'intelligence' comes from millions of these tuned together.

Summary

Each neuron computes a weighted sum of its inputs, adds a bias, and applies an activation function like ReLU. Networks stack many neurons across layers, and training iteratively adjusts weights/biases to reduce error via gradient descent.

References

Your notes

Notes save automatically.