
Linear Regression for Data Analysis
Delve into the world of linear regression as we explore finding the best-fitting line for data sets, minimizing Mean Square Error (MSE), using calculus to determine the optimal parameter, and more. Learn key concepts and techniques for fitting lines to data effectively.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Recitation 2: A First Look at Linear Regression 10-606 Fall 2021
Problem: Which line fits the data best? We want a good line in the form of: There is no m that goes through all of the points. How do we choose the best m?
We can evaluate different values of m with Mean Square Error (MSE) Notation Alert! For our specific problem and for m = 1... Is there an m better than m=1? How do we find an m that minimizes MSE?
Lets Expand MSE! First looking at the term inside the sum... Plugging this back into the sum...
For our specific problem... We can plot this quadratic function to easily see the minimum. How can we easily find the answer for arbitrary sets of data?
We can find what m should be for any dataset using calculus! Recall the first derivative test: For a function f, if f (c) = 0 then f either achieves a local minimum, maximum, or saddle point at c. For a quadratic function with this point will always be a global minimum, so don t worry about the different cases for now.
Solving for m... 1) Take the derivative of MSE 1) Set the derivative equal to 0
What about an offset term? is very limiting because we can only represent lines that go through the origin. How do we find best fit lines of the form
The Partial Derivative. For a function with more than one variable, the partial derivative is the derivative with respect to one of the variables, with the other variables treated as constants. Notation Alert! An Example: Partial with respect to w: Partial with respect to z:
Extension of first derivative test to multiple variables. The function achieves a local maximum, local minimum, or saddle point at if all partial derivatives are 0 simultaneously at this point. That is... WORKSHEET TIME!