Chapter 1

What IS a Neural Network?

You've used ChatGPT. You've watched it write poems, answer questions, and even crack jokes. But have you ever wondered what's actually happening inside? Let's peek under the hood and meet the tiny building block that makes all of AI possible: the neuron.

🧠 A Neuron is a Decision-Maker

Before we get into any math, let's build an analogy. Imagine you're at a town meeting, and there's a vote on whether to build a new park. Each person at the meeting shares their opinion — some are enthusiastic ("Yes! Build it!"), others are skeptical ("I don't think so"). Now imagine there's one person — let's call them the Voter — who has to listen to everyone and make a final decision.

Here's the thing about the Voter: they don't trust everyone equally. Their best friend's opinion carries a lot of weight, but the stranger in the back row? Not so much. The Voter also has their own pre-existing opinion (a gut feeling) before hearing anyone else. After weighing all the opinions, the Voter makes a decision: thumbs up or thumbs down.

That's exactly what a neuron does. A neuron in a neural network is a tiny mathematical decision-maker. It takes in numbers (the opinions), multiplies each one by how much it "trusts" that input (the weight — a number that says how important each input is), adds them all up, throws in its own gut feeling (the bias — a number that shifts the neuron's default preference), and then makes a decision.

But wait — there's one more step. The raw sum could be any number: -500, 0, a million. That's not very useful. We need the neuron to give us something manageable, like a number between 0 and 1, where 0 means "definitely no" and 1 means "definitely yes." That's where the activation function comes in.

🎚️ The Activation Function: A Volume Knob

Think of the activation function as a volume knob on a speaker. No matter how loud the raw signal is (whether it's a whisper or a scream), the volume knob squishes it into a useful range so your ears don't explode and you can still hear something.

The most common activation function for beginners is called the sigmoid function (pronounced "SIG-moyd"). Sigmoid takes any number — positive, negative, huge, tiny — and squishes it into a value between 0 and 1. Here are some examples:

See the pattern? Very negative numbers get squished close to 0. Very positive numbers get squished close to 1. And anything near zero lands around 0.5. This "squishing" is what makes the neuron's output interpretable — you can think of it as a confidence level. 0.9 means "I'm 90% sure this is a yes!" and 0.1 means "I'm 90% sure this is a no."

📐 The Formula (Don't Panic!)

Now that we understand all the pieces, here's the complete formula for what a single neuron does:

output = activation( weight × input + bias )

Let's break that down one more time, left to right:

  1. input — the number coming in (someone's opinion at the meeting)
  2. weight — how much the neuron trusts that input (how much the Voter values that person's opinion). A high weight = "I really listen to you." A weight near zero = "I'm ignoring you."
  3. weight × input — multiply them together. This is the "weighted opinion."
  4. + bias — add the neuron's own gut feeling. A positive bias means the neuron wants to say yes. A negative bias means it's skeptical by default.
  5. activation() — squish the result through sigmoid so we get a nice number between 0 and 1.

That's it. That's the entire brain cell of artificial intelligence. Every AI — from the one that recommends your next TikTok video to ChatGPT itself — is built from millions (or billions) of these tiny voters, all wired together.

🎛️ Interactive: Your First Neuron

Enough reading — let's play. Below is a live neuron you can control. There are three sliders: Input, Weight, and Bias. Drag them around and watch what happens to the neuron's output in real time.

On the right, you'll see a visual diagram: the input flows in from the left, gets multiplied by the weight along the connection line, enters the neuron (the big purple circle), gets the bias added, and then passes through the sigmoid curve at the bottom. The orange dot on the sigmoid curve shows where your current weighted sum lands.

💡 Things to try
  • Set the weight to 0. What happens? (The neuron ignores the input entirely!)
  • Set the weight to a negative number. Now higher inputs make the output lower. The neuron is "anti-correlated" with the input.
  • Crank the bias to +5. The neuron is always excited, no matter what the input is — it has a very strong gut feeling of "yes!"
  • Set a large weight (like 3) and sweep the input from -5 to 10. Watch how the sigmoid curve creates a sharp "switch" from 0 to 1.
3.0
1.0
0.0
3.0
Weighted Sum
0.95
Output (Sigmoid)
The neuron received 3.0, multiplied by weight 1.0, added bias 0.0 to get 3.0. After sigmoid, it outputs 0.95 — very excited!

Notice how the weighted sum (weight × input + bias) can be any number, but the output is always between 0 and 1 thanks to sigmoid. That's the activation function doing its job — squishing the result into a range we can interpret as a confidence level.

🎯 Activity: Build a "Greater Than 5" Detector

Here's your first real challenge. Can you turn the neuron above into a number classifier? Specifically, we want it to output a number close to 1 (above 0.6) when the input is greater than 5, and close to 0 (below 0.4) when the input is 5 or less.

In other words, we want our neuron to act like a simple detector: "Is this number bigger than 5? Yes or no?" If the input is 7, the neuron should say something like 0.95 (yes!). If the input is 2, it should say something like 0.04 (nope).

How to think about it:

When you're ready, click Test My Neuron and it will check all inputs from 0 to 10. You need all 11 to pass. Don't worry if it takes a few tries — that's how learning works (for humans too!).

Adjust the sliders above, then click "Test My Neuron" to see how you did!

💡 Why Does This Matter?

You might be thinking: "Okay, cool, one neuron can detect if a number is bigger than 5. But ChatGPT writes entire essays. How do we get from here to there?"

Great question. The secret is that ChatGPT is made of billions of these neurons, all connected together in layers. Each neuron on its own is simple — it just multiplies, adds, and squishes. But when you wire millions of them together, something magical happens: the network can learn incredibly complex patterns. One neuron might detect "is this word a noun?", another might detect "does this sentence sound formal?", and together, layer after layer, they build up an understanding of language.

Think of it like LEGO bricks. One brick is boring. But with enough of them, you can build a castle, a spaceship, or anything you can imagine. The neuron is your LEGO brick. In the next chapters, we'll start connecting them together and teaching them to learn.

🧱 One neuron = one LEGO brick.
Billions of neurons wired together = ChatGPT.

Next up: how does a neuron learn the right weights?