A single cell that mimics the brain, the neuron
Say several switches feed into one bulb. Some switches push the bulb hard, some only a little. Add up all the push, and if it is bright enough the bulb turns on, if not it stays off. An artificial neuron is exactly this. It multiplies each input by a strength (a weight), adds them up, and if the sum passes a threshold it turns on.
Multiply inputs by weights and add
In logic gates we saw
inputs come in and one answer come out.
An artificial neuron is similar:
it takes several inputs and makes one value.
But it does not just add the inputs.
It sets a strength for each input,
multiplies by that strength, then adds.
This strength is called a weight.
Important inputs get a big weight,
less important ones get a small weight.
Toggle inputs on and off. Only the on inputs are multiplied by their weights and added to the sum.
Each time you turned an input on,
the sum grew by that input's weight.
An input with a big weight moves the sum a lot,
one with a small weight only a little.
So the sum is not the inputs themselves
but the result of inputs and weights seen together.
Now, does this shape look familiar?
Multiplying inputs by some number and adding.
A weight is the slope from regression
Recall drawing a line as ax+b in regression.
We multiplied input x by slope a and added b.
The bigger the slope a,
the more the result changed for the same x.
A neuron's weight is exactly this slope.
Multiplying an input by a weight
is the same as multiplying by a slope.
So when you raise a weight,
that input affects the result more strongly.
Lower the weight and the effect weakens.
Tap to raise and lower the weight. Like a slope it multiplies the input, and the output follows.
Moving the weight, the output followed.
As changing the slope tilts the line,
changing the weight shifts the neuron's response.
So to make the neuron answer well,
setting the weights well is the heart of it.
But after the sum is found,
what does the neuron do?
It does not just send the sum out;
it makes one more decision.
Pass the threshold and it fires
After finding the sum, the neuron
compares it to a single baseline.
This baseline is called a threshold.
If the sum passes the threshold, the neuron fires.
Firing means it gave the answer 1.
If the sum falls short, the neuron stays off.
Being off means the answer 0.
As a bulb lights only when bright enough,
the neuron fires only when the sum is big enough.
So the neuron makes an on-or-off decision.
Tap to raise and lower the sum. Cross the threshold line and the neuron fires (1), below it stays off (0).
The instant the sum passed the threshold, the neuron snapped on.
On or off, the answer settles to one of two.
This way the neuron takes inputs
and decides on its own whether to fire.
But it does not answer well from the start.
With rough weights it stays off when it should fire,
and fires when it should stay off.
That is a mistake.
When wrong, how does the neuron get better?
When wrong, nudge the weights a little
Earlier we learned gradient descent,
that method of reading how wrong you are
and stepping downhill a little at a time.
A neuron does just the same.
If it should fire but stayed off,
it raises the weights a bit so the sum grows.
If it should stay off but fired,
it lowers the weights a bit so the sum shrinks.
It does not change everything at once;
it moves one step, sized by how wrong it was.
Repeat this many times and it gets better and better.
See the wrong answer and tap adjust. The weight steps toward the correct answer, getting it right over time.
The more it fixed, the less it was wrong.
With the right direction, even one step at a time,
it ends up close to the correct answer.
This is how a neuron learns.
A person does not set every weight by hand;
it reads its mistakes and tunes its own weights.
Repeat this adjustment over many examples
and the neuron comes to judge quite cleverly.
Now let's wrap the whole thing up.
Let's wrap up
Gathered on one line, it is this.
A neuron multiplies each input by a weight and adds.
This is the same shape as ax+b in regression,
and the slope a is the weight.
If the sum passes the threshold it fires (1),
if not it stays off (0).
When wrong, like gradient descent,
it fixes the weights a little by how wrong it was.
Repeat this and it gets better and better.
Multiply and add, fire by a threshold, adjust when wrong. That is a neuron.
Tap the key points in order to review. (inputs times weights summed -> weight is the slope -> fire if past the threshold -> adjust when wrong)
Now you know a small calculator
that mimics a single cell of the brain.
Multiply and add, on and off, fix when wrong,
this simple cell is the start of learning.
One such cell already judges fairly well,
but link many of these cells together
and far more complex things can be learned.
Next, how do these cells gather
to form a larger intelligence?
Let's keep exploring together.