LinearRegression in Pytorch and sklearn, what is the differnece? I am currently implementing Linear Regression in Pytorch and sklearn and I get two different Mean squared error (MSE) values for both. MSE is lower for Pytorch Linear Regression.
Wanted to ask what the difference between linear regression in PyTorch and sklearn?
I understand for that Pytorch the workflow follows:

*

*Create LinearRegression class

*Define model from this LinearRegression class

*MSE: Mean Squared error

*Optimization (SGD: stochastic gradietnt descent)

*Backpropagation

*Prediction


The biggest difference is that linear regression usually is not fitted using gradient descent. Gradient descent is inferior and inefficient for this problem.
From scikit-learn’s documentation

From the implementation point of view, this is just plain Ordinary Least Squares (scipy.linalg.lstsq) or Non Negative Least Squares (scipy.optimize.nnls) wrapped as a predictor object.

So instead gradient descent use least squares in PyTorch.
