OLS Regression with Scikit-Learn

Scikit-learn

Scikit-learn can be used to run a normal regression, however, its focus as a library is on machine learning and prediction, not statistical inference, so it doesnt provide a full set of regression statistics. See statsmodel implementation below.

import numpy as np from sklearn.linear_model import SGDRegressor inputs = [[1.0,1.0],[1.2,2.0],[0.9,0.6]] outputs = [[1],[2],[0.9]] X = np.array(inputs) y = np.array(outputs) reg = SGDRegressor() reg.fit(X,y) print(reg.intercept_) print(reg.coef_)