Brainstorming Session – Supervised Learning
Q1: Why does it add a constant (bias/intercept)?
Imagine we’re fitting a line through dots.
Without a constant:
If we only use y = m * x, our line would always go through (0,0). But what if our data looks like this?
x | y |
---|---|
1 | 3 |
2 | 5 |
3 | 7 |
Clearly, y = 2x + 1 fits best — not y = 2x.
That +1 is the bias (or intercept) — it lets the line shift up or down to match the data.
Think of it like this:
- The slope (m) tilts the line.
- The bias (c) moves the line up or down.
- So: it adds the constant to better fit data that doesn’t start at 0.
Q2: When does it adjust the slope and the constant?
Answer: Every training step!
During training (every loop in gradient descent), the model:
- Sees the prediction is wrong (error)
- Figures out how wrong it is
- Calculates how much to adjust both the slope (m) and bias (c)
- Updates them to reduce the error
This happens on every iteration (called an “epoch”) until the error becomes really small.
Q3: How does it decide how to adjust them?
It uses gradients (think: slopes of the error curve).
Let’s visualize it simply:
- The model wants to find the lowest error.
- It draws a little hill for error vs. weight or bias.
- Then it walks downhill toward less error using calculus.
The math (we saw this in the gradient descent part):
m -= learning_rate * total_error_m
c -= learning_rate * total_error_c
If the error says: “Your guess is too low,” it increases m or c
If the guess is too high, it decreases m or c
This continues until the guesses are very close to the actual values
Summary: One-Liner Answers
Question | Simple Answer |
---|---|
Why add a constant? | To shift the line up/down and fit data that doesn’t pass through zero. |
When adjust? | On every training step (epoch) during learning. |
How adjust? | Using the gradient of the error — small steps that make predictions more accurate. |
Supervised Learning – Connecting the Dots