Skip to content

Instantly share code, notes, and snippets.

@ageitgey
Created September 16, 2014 00:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ageitgey/1d85f8482953be37d9c3 to your computer and use it in GitHub Desktop.
Save ageitgey/1d85f8482953be37d9c3 to your computer and use it in GitHub Desktop.
from sklearn import linear_model
X = [
[4,3,1,0,1],
[5,2,1,0,1],
[4,2,1,1,1],
[3,1,0,1,1],
[1,1,0,1,1]
]
y = [4, 6, 6, 3, 1]
clf = linear_model.LinearRegression()
clf.fit (X, y)
print clf.coef_
# [ 1. -1. 3. 1. 0.]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment