Machine Learning

Linear Models

Linear and logistic regression score the input with the same line, z = wx + b. Draw each residual as a literal square, snap to the least-squares optimum, and watch the same descent fit both models.

dataclass 1the modelthe gap the loss measuresmean point (x̄, ȳ)

Drag a point to move it · click empty space to add one

—
—

R²—
sum of squares Σr²—
least-squares optimum—
descent steps—

What to observe

  1. Switch the Model. The score z = wx + b is the same line either way: regression hands it back as the answer, classification squashes it into a probability between 0 and 1.
  2. Press Run in either model. One descent loop fits both, because the gradient comes out identical: (prediction − y)·x, averaged over the points.
  3. Each residual is drawn as a square. Tilt the line and the squares grow;Snap to least squares gives the smallest total area, and that line passes through the mean point (x̄, ȳ).
  4. Drag one point far off the trend. Its square dwarfs the rest, so the optimum swings toward it: least squares is not robust.

Shortcuts:space run/pause · s step · r reset · f fullscreen