Explain every part of a neuron and change its prediction by changing its parameters.
Step 1
A model is a calculation with adjustable numbers
You already know how to write rules in Python. Machine learning adds a different way to choose some of the numbers in those rules: learn them from examples. A model takes an input, calculates a prediction, and later compares it with a known target. It does not understand a task the way a person does.
Start with one input and two adjustable numbers. A weight controls how much the input matters. A bias shifts the result even when the input is zero. We call these adjustable numbers parameters. For now, we choose them ourselves: prediction = weight * x + bias.
Step 2
More inputs, one output
A neuron can combine several inputs. Each input gets its own weight; the neuron adds those weighted inputs and a bias. Here the two inputs are just invented measurements, not real-world evidence.
An activation changes the combined value before passing it onward. ReLU is one simple choice: keep positive values and replace negative ones with zero. Later, nonlinear activations let several layers represent patterns that a single straight line cannot.
Step 3
What makes a network?
A layer is a group of neurons. A neural network connects layers so one layer's outputs become the next layer's inputs. A hidden layer sits between the original inputs and the final output.
Our goal is deliberately small: two inputs → eight hidden neurons → one output. It is a first step into deep learning, not a large language model. Before adding those neurons, we need a way to measure mistakes and improve the parameters.
Your turn
Practice & explain
Use the assignment workspace or edit the cells above. Write your own version before opening a hint.
1.1 · Write your own neuron
Write a function neuron(x, weight, bias) that returns weight * x + bias. Check neuron(4, 2, 1) == 9 and neuron(0, 2, 1) == 1. Explain why the second result depends only on the bias.
Need a hint?
Return the calculation; printing inside the function is not enough if another calculation needs the result.
1.2 · Predict, then run
Use the two-input example with inputs [1.0, 3.0], weights [2.0, -1.0], and bias 0.0. Write down the score and ReLU result before running it.
Need a hint?
The weighted sum is 2 - 3. ReLU clips a negative score to zero.