Intermediate 25 min

What we will build

Picture four students. You know how many hours each one studied. You know if they passed (1) or failed (0).

Study HoursPassed
10
20
31
41

The pattern is obvious to you: more study hours tends to mean pass. A tiny neural network will learn that pattern from the numbers—not from rules we hard-code.

We are not building ChatGPT. We are building one neuron, then two inputs, so you can see the full loop: predict → measure mistake → adjust → repeat.

Why start this small?

Real models have millions of weights. That noise hides the mechanics. With four rows and one weight, you can:

  • Calculate a prediction on paper
  • See why loss goes up or down
  • Watch weights change epoch by epoch

When you later open PyTorch, you’ll recognize the same skeleton underneath.

What is a neural network?

Plain version: a neural network is a set of small math units. Each unit takes input, tweaks it with numbers called weights and bias, and returns an output.

The building block looks like this:

output = input × weight + bias
PieceRole
InputThe data (here: study hours)
WeightHow strongly that input pushes the output
BiasA constant shift—lets the line cross the axis where it needs to
OutputThe prediction (raw number at first; probability later)

Nothing here is “thinking.” It is arithmetic all the way down.

How our tutorial fits together

hours raw z prob vs label error next epoch Data Neuron Sigmoid Loss Update w,b

Over the next pages we fill in each box. Page 2 is the neuron. Page 3 is sigmoid and pass/fail. Page 4 is loss and training.

From hours to pass/fail (preview)

This animated concept requires JavaScript to be enabled.

Frames:

  1. Study hours go in as the input.

    Study hours go in as the input.

  2. The neuron multiplies by a weight, adds bias, and produces a raw score.

    The neuron multiplies by a weight, adds bias, and produces a raw score.

  3. Sigmoid squeezes that score into a probability between 0 and 1.

    Sigmoid squeezes that score into a probability between 0 and 1.

What you should bring

  • A terminal or notebook if you want to run code (optional on this page)
  • Willingness to multiply two numbers by hand once or twice—it pays off later

Honest scope note

Production systems use big datasets, regularization, GPUs, and frameworks. The idea you learn here is still the same: combine inputs with weights, compare to truth, reduce loss, update weights.

Key takeaways

  1. We predict pass/fail from study hours using four labeled examples.
  2. A neuron is input × weight + bias—no hidden intelligence.
  3. Training is a loop: forward pass → loss → small weight changes.

Next up: we implement the single neuron and run the formula with real numbers.

Progress 14%
Page 1 of 7
Previous Next