# Linear Regression: A complete story

Source: Deep Learning on Medium # 2. Mathematics behind the model:

Even though we have python libraries which can do the regression analysis in a single line of code, it is really important to know the mathematics behind the model. Because only when you know how a model works from the scratch, you will be able to tweak different model parameters with respect to your problem statement and the dataset at your hand to get the desired result.

There are two kinds of variables in a linear regression model:

• The input or independent or predictor variable(s) is the input for the model and it helps in predicting the output variable. It is represented as X.
• The output or dependent variable(s) is the output of the model i.e., the variable that we want to predict. It is represented as Y.

## 2.1 Simple linear regression:

When there is one input variable/independent variable (X) then it is called simple linear regression.

The simple linear regression equation looks like this: