```
from sklearn.linear_model import LinearRegression
regressor = LinearRegression()
regressor.fit(x_train , y_train)
regressor.predict(x_test)
```

Here how **fit** works , does it use gradient descent ?

I know the purpose of the **fit** is to find best fit line , but how it finds it ?

does it only use the simple formula y=mx+c to find y(guess) or does it optimizes also

I also know that fit is used in feature scaling and its purpose is to find the standard deviation and mean and through transform function the following data are scaled using that calculated mean and SD.

But i am unable to understand how fit and predict work in case of Linear Regression .

so please share ur view .