Here you predict a certain value derived from the input using linear regression and for this, it is required to understand the statistics behind Linear Regression and bsics of numpy and pandas libraries. Firstly, let us understand linear regression with a toy example subsequently we'll get an enriched overview of how it works from scratch (almost).
We divide the complete code into two classes,
- Linear Regression from Scratch(almost)
- Linear Regression from sklearn(Machine Learning Library in python).
Here is a link(PDF) for theoritical and mathematical modelling for Linear Regression and it's Statistics. This elucidates how predictions are made step on step with mathematical construction and visualization for goodness of fit.