What Is a Model?
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
- True signal
The fitted numbers (3 of them — this is the whole model)
- w0 · 1 (intercept)-7.0225
- w1 · x12.1774
- w2 · x²-2.7165
Model controls
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:
- the model’s predicted output.
- the input feature.
- the coefficients (the knobs) chosen during training.
- 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 to zero, so the model can only output a single constant, no matter the input.
Trace it by hand
Take a tiny dataset of three points: (1, 2), (2, 3) and (3, 5). We train two models on it by least squares — a degree-0 constant and a degree-1 line — and score both with mean squared error. Values are rounded to 2 decimals (MSE to 3).
The data and the two candidate models
The only difference between the two models is one extra knob: the slope.
Degree 0: the best constant is the mean
With zero degrees of freedom in x, least squares can do no better than predict the average everywhere.
Degree 1: fit the slope and intercept
x-bar is 2 and y-bar is 3.33, so the numerator sums to 3 and the denominator to 2.
The line's predictions
Residuals against the actual 2, 3, 5 are 0.17, minus 0.33, and 0.17.
Score the line
Compare with 1.56 for the constant: same data, same loss, one more knob.
What just happened: Turning one extra knob — the slope — dropped MSE from 1.56 to 0.056, a factor of 28. A model is just a function with adjustable knobs, and training is choosing the knob values that shrink the measured gap to the data.
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")
What happens: Systematic error: the model is too simple to capture the pattern in the data.
Where what is a model? is used
A model is a function fit to data, and that single idea powers products people use every day. When Gmail sorts a message into spam or primary, a classification model maps the words, sender, and headers to a probability. When Zillow estimates a home price or a bank sets a credit limit, a regression model turns features like square footage, location, and payment history into a number. Netflix and Spotify recommendations, weather forecasts, medical imaging triage, and the autocomplete in your phone keyboard are all models: functions whose parameters were chosen so their outputs match observed data. The domain and the math differ, but the recipe is constant. Collect examples, pick a family of functions, and tune it until predictions line up with reality.
A frequent misconception is that a model stores or memorizes the training data like a lookup table. In reality a model compresses patterns into parameters; it generalizes to inputs it has never seen precisely because it does not keep every example. A model that truly memorized would fail on anything new. A second pitfall is treating a model as objective truth. A model only reflects the data it was fit to, so biased, stale, or unrepresentative data produces confidently wrong predictions. If a hiring model learns from past decisions that favored one group, it will reproduce that bias. Understanding what a model is, a fitted function and nothing more, keeps you skeptical about both its accuracy and its fairness.
Frequently asked questions
What is a machine learning model in simple terms?
What is the difference between a model and an algorithm?
Does a model just memorize the training data?
What does it mean to fit a model?
Can a model be wrong even if it is well trained?
Written & reviewed by the ML Visualization team · Last updated .