Skip to content
ML Visualization

What Is a Model?

FoundationsBeginner~5 min

What Is a Model?A machine learning model is a mathematical function with adjustable parameters that maps inputs to predictions. Training a model means choosing the parameters that best fit observed data.

A machine learning model is just a function — it takes in numbers and spits out a prediction. The trick is finding the function that fits your data best.

  • Data points
  • Model
  • Residuals
Quadratic
Mean squared error0.122

Slide from a constant (a flat guess) up to a curve. Watch the residuals shrink as the model gains the flexibility to follow the data.

The idea in plain words

A model is a function with adjustable knobs. You feed it an input and it returns a prediction; “training” means turning the knobs until the predictions line up with the data you’ve actually seen. Slide the complexity control: a flat constant can’t follow any trend, a line can follow a slope, and a curve can bend to the data.

A too-simple model leaves a visible, systematic gap — underfitting. How we measure that gap is the job of a loss function, and the simplest useful model is linear regression.

Now, the math

A polynomial model of degree d predicts:

y^=c0+c1x+c2x2++cdxd\hat{y} = c_0 + c_1 x + c_2 x^2 + \dots + c_d x^d
y^\hat{y}
the model’s predicted output.
xx
the input feature.
cic_i
the coefficients (the knobs) chosen during training.
dd
the degree — how much the curve can bend.
Show the derivation

For each degree, training picks the coefficients that minimize total squared error — a problem with a clean closed-form solution for polynomials. Degree 0 forces every coefficient except c0c_0 to zero, so the model can only output a single constant, no matter the input.

Now Break It

Try this: Fit a flat horizontal line to clearly curved data — show the systematic error that a too-simple model produces.

Control: Model complexity selector (set to "constant")

Last updated .