1from sklearn.linear_model import LinearRegression
2X = np.array([[1, 1], [1, 2], [2, 2], [2, 3]])
3y = np.dot(X, np.array([1, 2])) + 3
4reg = LinearRegression().fit(X, y)
5reg.score(X, y)
6reg.coef_
7reg.intercept_
8reg.predict(np.array([[3, 5]]))
1from sklearn.linear_model import LinearRegression
2reg = LinearRegression()
3reg.score(X, y) #Fit linear model
4reg.coef_ #Estimated coefficients for the linear regression problem
5reg.predict(y) #Predict using the linear model