from sklearn import linear_model reg = linear_model.LinearRegression() reg.fit ([[0, 0], [1, 1], [2, 2]], [0, 1, 2]) LinearRegression() reg.fit([[0, 0], [1, 1], [2, 2]], [0, 1, 2]) LinearRegression() reg.coef_ array([0.5, 0.5])