Concepts 🚀 Project 🧮 Labs
🧮 Labs / ML Advanced / Interactive: Linear Regression — drag the slope + intercept

Interactive: Linear Regression — drag the slope + intercept

DRAG the slope and intercept sliders. SEE the line move in real-time. SEE the MSE (cost) change. This is how you build intuition for what .fit() does.

interactive.lab v3.1
Drag the sliders — see the graph update in real-time
Live interactive chart drag sliders → graph updates
If you see this, the interactive chart is loading...
If it doesn't appear in 2 seconds, press Ctrl+Shift+R to hard refresh.
🧠 How it works

INTERACTIVE LEARNING: Don't just read about linear regression — FEEL it. Drag the slope slider left/right. Watch the line rotate. Drag the intercept slider. Watch the line move up/down. The MSE number tells you how bad your line is. Find the minimum! This is exactly what gradient descent does — it searches for the slope + intercept that minimizes MSE. You're doing it manually; the algorithm does it in milliseconds. Increase the noise slider to see how harder data makes the minimum less obvious.

✏️ Try these changes
  • Set slope=3, intercept=2 — that's the true relationship
    → MSE should be near minimum
  • Set slope=0 — the line is flat, MSE is high
    → the model predicts the same value for everything
  • Set noise=5 — data is very scattered
    → harder to find the right line by eye
  • Set slope=-2 — negative relationship
    → the line goes downhill