Skip to content

Instantly share code, notes, and snippets.

@GermanCM
Created December 19, 2018 10:53
Show Gist options
  • Save GermanCM/4f1fe068bd9a0727826dd7478c03fdb0 to your computer and use it in GitHub Desktop.
Save GermanCM/4f1fe068bd9a0727826dd7478c03fdb0 to your computer and use it in GitHub Desktop.
linear regression via scikit-learn
def linear_regression_via_scikit(X_train, y_train):
from sklearn import linear_model
linear_reg = linear_model.LinearRegression()
linear_reg.fit(X_train.values.reshape((len(X_train),1)), y_train.values.reshape((len(X_train),1)))
return linear_reg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment