What Is a Neural Network β And How Does It Actually Think?

Hi there! π I'm a frontend developer with hands-on experience building intuitive and scalable user interfaces. I specialize in technologies like React, TypeScript, Next.js, and Redux, and I'm driven by a passion for crafting meaningful, user-friendly projects. Currently diving deep into problem-solving and algorithms to refine my developer mindset, I enjoy breaking down complex challenges into elegant solutions. When Iβm not coding, youβll find me contributing to open-source projects or sharing insights about web development, design patterns, and tech trends here on Hashnode. Letβs connect and learn together! π
100 million. That is how many spam emails Gmail filters every single day. No human is sitting there hitting "delete." A machine is making those calls in the blink of an eye.
If youβve ever wondered whatβs actually happening under the hood of that machineβor inside the "brain" of ChatGPTβyouβre in the right place. In this series, weβre going from zero to a full understanding of AI.
Let's start at the very beginning.
The Analogy That Makes Everything Click
Before we touch any technical concept, here's the one mental model you need to carry through this entire series:
A neural network is a machine that learns the same way you do β by making mistakes, understanding what went wrong, and adjusting.
When you were a child learning to ride a bike, nobody gave you a 200-page manual. You got on. You fell. You understood what made you fall. You adjusted. You tried again.
A neural network does the exact same thing β except instead of a bike, it's processing emails, images, or language. And instead of a child, it's millions of mathematical operations happening simultaneously.
That's the whole idea. Everything else is just the details.
Your Brain vs. a Neural Network
Here's something that might surprise you: the way your brain works and the way a neural network works are remarkably similar.
Your brain has about 86 billion neurons. Each one is a tiny cell that receives signals from other neurons, processes them, and decides whether to fire a signal forward to the next neuron.
Over time β through experience, repetition, and feedback β the connections between your neurons get stronger or weaker. That's literally what learning is, at the biological level.
A neural network does the same thing in math:
The core insight: a neural network is just layers of these artificial neurons, connected together, passing numbers forward.
What Does One Neuron Actually Do?
This is the question most explanations skip. Let's not. A single artificial neuron does four things:
1. Receives inputs These are just numbers. For an email spam detector, inputs might be: does the email contain the word "free"? Does it have a suspicious link? Is the sender in your contacts?
2. Multiplies each input by a weight A weight is a number that represents how important that input is. "free" might have a high weight for spam detection. "meeting" would have a very low one.
3. Adds a bias Think of bias as the neuron's personal sensitivity threshold. It shifts the result up or down slightly.
4. Passes through an activation function This decides: is this signal strong enough to pass forward, or do we send zero? The most common one, called ReLU, simply says: if the result is positive, pass it. If negative, send zero.
Here's the full picture of one neuron:
Input Weight Contribution
ββββββ ββββββ βββββββββββββββ
x1 = 1 Γ w1 = 2.8 = 2.8 β "free" is very suspicious
x2 = 1 Γ w2 = 2.1 = 2.1 β "money" too
x3 = 1 Γ w3 = 1.9 = 1.9 β "click" adds up
x4 = 1 Γ w4 = 2.5 = 2.5 β "password" = red flag
x5 = 1 Γ w5 = 1.8 = 1.8 β urgency words
x6 = 1 Γ w6 = 1.5 = 1.5 β caps/exclamation
x7 = 0 Γ w7 = 0.1 = 0.0 β trusted domain (absent)
x8 = 1 Γ w8 = 2.0 = 2.0 β suspicious link
x9 = 0 Γ w9 = 0.8 = 0.0 β in contacts (absent)
x10= 0 Γ w10= 0.6 = 0.0 β attachment (absent)
βββββ
SUM = 14.6
+ Bias = +0.5
βββββββββββββββββββββ
Total = 15.1
β
Activation Function
(ReLU: if > 0, keep it)
Output = 15.1 π₯ FIRES STRONGLY
The math in one line:
Output = Activation( Ξ£(input Γ weight) + bias )
That equation runs in every single neuron of every single neural network β from a simple spam filter to GPT-4. The scale changes. The idea never does.
Layers: How Neurons Work Together
A single neuron can't do much. But stack thousands of them in layers, and something remarkable happens.
Here's the structure of every neural network:
Input Layer β Hidden Layers β Output Layer
(data enters) (patterns form) (decision made)
Each layer has a job:
Input layer β receives raw data (our email features as numbers)
Hidden layers β this is where the actual learning happens. Each layer finds increasingly complex patterns. The first layer might notice "this email has the word free." The second notices "free AND urgent AND suspicious link together." The third recognizes "this exact combination = phishing attack."
Output layer β makes the final call. Safe / Spam / Threat.
Now Building Our Spam Detector
Let's make this real. Imagine we want to build a system that reads incoming emails and decides: is this safe, spam, or a security threat?
Step 1 β Turn the email into numbers
AI only understands numbers. So the first thing we do is extract features from the email:
Email: "CONGRATULATIONS!! You won FREE money! Click NOW to claim!"
From: prize-winner@totally-legit.xyz
Feature extraction:
βββββββββββββββββββββββββββββ
β "free" present? β 1 β
β "money" present? β 1 β
β "click" present? β 1 β
β Urgent language ("now", "claim") β 1 β
β Excessive caps / exclamation? β 1 β
β Sender domain known/trusted? β 0 β
β Suspicious external link? β 1 β
β Sender in your contacts? β 0 β
ββββββββββββββββββββββββββββ
Input vector: [1, 1, 1, 1, 1, 0, 1, 0]
Step 2 β Feed it through the network
These 8 numbers become the input to our neural network. Each layer processes them, passes patterns forward, and the output layer gives us:
SAFE: 2%
SPAM: 15%
THREAT: 83% β WINNER
π¨ Email blocked.
Step 3 β But how did it know?
Here's the thing β right now, our network doesn't know anything. Those weights? They started as random numbers.
Initial (random) weights:
w1 = 0.23 w2 = -0.67 w3 = 0.91 w4 = -0.14 ...
It's like a newborn. Has all the equipment. Knows nothing yet.
That changes in Part 2 β where we feed it thousands of emails and watch it learn.
What You Just Learned
Let's lock in the key ideas from Part 1:
Neural networks are inspired by the brain β layers of interconnected artificial neurons that process information and pass signals forward.
Each neuron does simple math β multiply inputs by weights, add bias, pass through activation function. That's it. That's the whole atomic unit.
Weights determine importance β "free" gets a high weight for spam detection. "meeting" gets a low one. These weights are what the network learns.
Layers find increasingly complex patterns β early layers catch simple signals, later layers combine them into meaningful understanding.
The network starts knowing nothing β weights begin random. Learning turns randomness into intelligence. That's exactly what Part 2 covers.
What's Coming in Part 2
You now understand how a neural network thinks β how data flows in, gets processed, and produces a decision.
But here's the question that changes everything:
Those weights we talked about β
w1 = 0.23, w2 = -0.67...β they started random. How do they become something meaningful? How does the network go from random guessing to 97% accuracy?
The answer is training. And training is one of the most elegant ideas in all of computer science.
In Part 2, we'll watch our spam detector learn from scratch β making mistakes, understanding them, and adjusting, thousands of times β until it becomes an expert.
See you there. π



