Linear regression performs the task to predict a dependent variable value( y>

based on a given independent variable( x>

. So, this regression technique finds out a linear relationship between x( input>

and y( output>

. Hence, the name is Linear Regression.

In the figure above, X( input>

is the work experience and Y( output>

is the salary of a person. The regression line is the stylish fit line for our model.

While training the model we're given

x input training data( univariate – one input variable( parameter>

>

y labels to data( supervised learning>

When training the model – it fits the best line to predict the value of y for a given value of x. The model gets the best regression fit line by finding the best θ1 and θ2 values.

θ1 intercept

θ2 coefficient of x

Once we find the best θ1 and θ2 values, we get the best fit line. So when we're finally using our model for prediction, it'll predict the value of y for the input value ofx.