AI engineering glossary · Classical ML algorithms

What is normal equation?

Normal equation: The closed-form formula that gives the least-squares weights in one step: w = (X^T X)^-1 X^T y, where X is the matrix of features and y the vector of targets. It needs no learning rate or iteration but becomes slow or unstable with many features or near-duplicate columns.

Level: intermediateTopic: Classical ML algorithms

Normal equation: an example

With 3 features and 10,000 rows, NumPy solves w = np.linalg.solve(X.T @ X, X.T @ y) directly instead of running gradient descent.

Related terms

More Classical ML algorithms terms

Where you learn it

Normal equation 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.