Skip to content

Conversation

@dagimtessema
Copy link

Description

This PR improves the explanation of the "Least-Squares" method in the Linear Regression README.

Motivation

While going through the lesson as a student, I found the existing explanation of why we square the residuals to be a bit brief. I have rephrased it to more clearly explain:

  1. Why we use magnitude instead of direction (avoiding negative values).
  2. The goal of minimizing the final sum to find the "best fit" line.

I believe this version is more accessible to beginners who are encountering the concept for the first time.

Type of change

  • Documentation update (non-breaking change)
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the documentation for the Least-Squares Regression concept in the Linear Regression lesson by expanding and clarifying the explanation of why residuals are squared. The revised content provides a more structured, beginner-friendly explanation with numbered points and clearer reasoning.

Changes:

  • Rephrased the introduction to Least-Squares Regression to explicitly mention residuals and the goal of minimizing total error
  • Added a numbered list explaining two main reasons for squaring distances: avoiding negative cancellation and penalizing outliers
  • Improved the closing explanation to emphasize finding the line with the smallest sum

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +50 to +52
1.**Magnitude over Direction:** We want to treat an error of -5 the same as an error of +5. Squaring turns all values positive.

2.**Penalizing Outliers:** Squaring gives more weight to larger errors, forcing the line to stay closer to points that are far away.
Copy link

Copilot AI Jan 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The numbered list items have incorrect spacing. There should be a space between the number and the period (e.g., "1." not "1.") and the text. The current formatting "1.**Magnitude" should be "1. **Magnitude". The same applies to item 2.

Suggested change
1.**Magnitude over Direction:** We want to treat an error of -5 the same as an error of +5. Squaring turns all values positive.
2.**Penalizing Outliers:** Squaring gives more weight to larger errors, forcing the line to stay closer to points that are far away.
1. **Magnitude over Direction:** We want to treat an error of -5 the same as an error of +5. Squaring turns all values positive.
2. **Penalizing Outliers:** Squaring gives more weight to larger errors, forcing the line to stay closer to points that are far away.
Copilot uses AI. Check for mistakes.
@dagimtessema
Copy link
Author

@copilot open a new pull request to apply changes based on the comments in this thread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant