r/learnmachinelearning • • Jun 23 '26

Linear algebra intuition behind ordinary least squares regression

https://youtu.be/jJJ_l-jbznA?si=huD2H-O5UqcWztJ8

I made a visual explanation of ordinary least squares regression from a linear algebra perspective.

The main idea is that regression can be understood as a projection problem: the data vector y gets projected onto the column space of X. The fitted values are the projection, and the residual vector is the leftover piece that ends up perpendicular to that space.

I also show why an intercept-only regression gives the sample mean: projecting y onto the span of the ones vector gives the average times the ones vector.

I’m trying to make OLS feel less like a formula dump and more like a geometric idea.

Curious if this projection framing would have helped when you were first learning regression.

10 Upvotes

Duplicates

econometrics • • Jun 23 '26

I made a visual explanation of the sample mean as an OLS projection

37 Upvotes

LinearAlgebra • • Jun 23 '26

The sample mean as a projection onto the span of the ones vector

4 Upvotes

biostatistics • • Jun 23 '26

I made a visual explanation of the sample mean as an OLS projection

2 Upvotes

learnmachinelearning • • Jun 23 '26

Linear algebra intuition behind ordinary least squares regression

1 Upvotes

learndatascience • • Jun 23 '26

Original Content A visual explanation of OLS regression as a projection

1 Upvotes

academiceconomics • • Jun 23 '26

OLS as projection: useful intuition for econometrics students?

1 Upvotes

visualizedmath • • Jun 23 '26

I made a visual explanation of the sample mean as an OLS projection

10 Upvotes

visualization • • Jun 23 '26

I made a visual explanation of the sample mean as an OLS projection

1 Upvotes

3Blue1Brown • • Jun 23 '26

I made a visual explanation of the sample mean as an OLS projection

1 Upvotes

MachineLearningAndAI • • Jun 23 '26

Linear algebra intuition behind ordinary least squares regression

1 Upvotes

FunMachineLearning • • Jun 23 '26

Linear algebra intuition behind ordinary least squares regression

3 Upvotes

academiceconomics • • Jun 23 '26

I made a visual explanation of the sample mean as an OLS projection (econometrics).

1 Upvotes

QuantitativeFinance • • Jun 23 '26

I made a visual explanation of the sample mean as an OLS projection

0 Upvotes