AI engineering glossary · Classical ML algorithms

What is OLS (ordinary least squares)?

Ordinary least squares (also called OLS): The classic way to fit a line or plane: choose the weights that minimise the sum of squared differences between actual and predicted values. It has a closed-form solution when the feature matrix is well behaved, and it gives the best linear unbiased estimates under the Gauss-Markov assumptions.

Level: intermediateTopic: Classical ML algorithms

Ordinary least squares: an example

With points (1,2), (2,3), (3,5), OLS gives the line y = 0.5 + 1.5x, which leaves smaller total squared error than any other straight line.

Related terms

More Classical ML algorithms terms

Where you learn it

Ordinary least squares is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.