The basic idea behind linear regression is quite simple. In mathematical terms we want to predict a dependent variable Y using an independent variable X. By assuming that the two variables correlate in a linear fashion we can predict Y with a simple linear formula:

Image for post

Linear equation by Author

(The wavy equal sign signifies “approximately”). Simply put, as soon as we know a bit about the relationship between the two coefficients, i.e. we have approximated the two coefficients **α **and β, we can (with some confidence) predict Y. Alpha α represents the intercept (value of y with f(x = 0)) and Beta β is the slope.

With the help of linear regression, we can answer a lot of questions; e.g.

  • “Is the rise of sea level connected to rising temperatures?”,
  • “How expensive will a house with 3 bedrooms be?”
  • “How many items do we sell if we increase our marketing budget by 20%?”

#linear-regression #machine-learning-python #data-science #machine-learning #python

Linear Regression by Hand
1.30 GEEK