oldoc63 / learningDS

Learning DS with Codecademy and Books
0 stars 0 forks source link

Equation of a line #466

Open oldoc63 opened 1 year ago

oldoc63 commented 1 year ago

Like the name implies, LINEar regression involves fitting a line to a set of data points. In order to fit a line, it's helpful to understand the equation for a line, which is often written as y=mx+b. In this equation:

The following plot shows a line with the equation y = 2x + 12:

Image

oldoc63 commented 1 year ago

Note that we can also have a line with a negative slope. For example, the following plot shows the line with the equation y = -2x + 8:

Image

oldoc63 commented 1 year ago
  1. We've plotted score (as the y-variable) against hours_studied (the x-variable), with a line going through the points. Let's see if we can improve this line so that it better fits the data. To start, the line appears to be to steep. Edit the equation of the line so that the slope is 10. This should make the line less steep (because we are decreasing the slope).
oldoc63 commented 1 year ago
  1. The line now appears to be parallel to the points but still sits below them. Leaving the slope of the line equal to 10, edit the equation of the line so that the y-intercept is 45.
oldoc63 commented 1 year ago
  1. This should move the line upward (because we are increasing the y-intercept).