Last active
December 11, 2017 15:28
-
-
Save gr33ndata/67843b14175a7a5f0292 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We are gonna use Scikit's LinearRegression model | |
from sklearn.linear_model import LinearRegression | |
# Your input data, X and Y are lists (or Numpy Arrays) | |
x = [[2,4],[3,6],[4,5],[6,7],[3,3],[2,5],[5,2]] | |
y = [14,21,22,32,15,16,19] | |
# Initialize the model then train it on the data | |
genius_regression_model = LinearRegression() | |
genius_regression_model.fit(x,y) | |
# Predict the corresponding value of Y for X = [8,4] | |
print genius_regression_model.predict([8,4]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
print (genius_regression_model.predict([[8,4]]))