← Back to AI in the Built Environment

Interactive learning environment

Machine Learning & Deep Learning Lab

Change one thing at a time, watch the model respond, and connect the picture to the mathematics.

Learning mode Guided exploration
Symbol guide
x
input or feature
w
learned weight
b
bias
ŷ
model prediction
L
loss or error
∂
small-change derivative
α
learning rate
Before changing anything

Make a prediction

Live moduleFoundations

Linear Regression

Fit a line to editable data and see how residuals, mean squared error, and gradient descent describe the same learning process.

Central questionHow does a model learn the best line?

Experiment controls

Edit the data

Click empty space to add a point. Drag a point to move it. Shift-click a point to remove it.

Data space

Prediction line and residuals

TrainingTestPrediction

The vertical segments are residuals: the difference between an observed value and the model prediction.

Training MSE—Average squared residual
Test MSE—Unseen-point error
Slope gradient—Direction to change w
Intercept gradient—Direction to change b
Parameter space

Loss surface

Drag or use the arrow keys to rotate. Height represents training loss; the red marker is the current model and the yellow line records gradient-descent steps.

Connect the views

What the model is calculating

A line makes one prediction at every horizontal position. Learning means adjusting its slope and intercept so the residuals become small overall—not necessarily zero for every point.

Try this

Select One influential outlier, choose Show best fit, then drag the isolated point. Watch the line and test error respond.