There are many sophisticated libraries like sci kit-learn in python to implement the easiest and the most popular machine learning algorithm i.e Linear Regression.It is method ,precisely a statistical method for predictive analysis.In simple word,LR is used to predict dependent variable or feature by establishing a relationship with the independent variables.For example,predicting the salary of employee(dependent variable) based on number of year of experience(independent variable) as both salary and year of experience have linear relation i.e salary increases with number of year of experience.

Most of the time Machine Learning models and Algorithms are treated as black box, without much exposure to the implementation details.But a good understanding about how things are working under the hood it can help us to quickly make an appropriate model,select the right training algorithm and some good sets of hyper-parameters for our model.Analyzing the black box will also help to perform error analysis more efficiently and debug the problems quickly.

There are two different ways to train the Linear Regression model:

- The first way is to use a close form equation which calculated the model parameters that best fir the model to the training set i.e model parameter that minimize the cost function over training set.
- The second way is to use a iterative optimization approach called Gradient Descent that gradually adjust the model parameter to minimize the cost function in training set,eventually it converges to the same set as achieve in first way.

Conclusion-

In this blog we have learn:-

- What is Linear regression-how it works.
- Quick example to understand Linear regression
- Various way to train the Linear regression model.