LinearRegression

The sklearn.linear_model.LinearRegression.fit() method is the most common method used to fit a linear regression model. It is implemented as an Ordinary Least Squares method and wrapped as a predictor object. See Least Squares for more information about the least squares method.

LinearRegression fits a linear model with coefficients \(w = (w_1, ..., w_p)\) to minimize the residual sum of squares between the observed targets in the dataset, and the targets predicted by the linear approximation. Mathematically it solves a problem of the form:

\[\min_w ||Xw - y||^2_2\]