Asked about Linear algebra in NumPy, by doing

How is linear regression a linear algebra problem?

An answer that works

Stack the inputs into a matrix X with a column of ones, and the targets into a vector y. The best weights minimise the squared length of Xw minus y, the least squares problem, which has a closed-form solution and is what lstsq computes.

Reading an answer is not being able to give one. The section that teaches this is Linear algebra in NumPy, by doing, 5 hours of Linear algebra.

Learn this properly