Linear Regression in Machine Learning is one of the most fundamental algorithm. It is the door to the magical world…