Created
March 6, 2019 12:28
-
-
Save IceCereal/d0b77ed9f4d515248f2bb31155d01d0b to your computer and use it in GitHub Desktop.
LinReg
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
from sklearn import linear_model | |
from matplotlib import pyplot as plt | |
x = [[2],[1],[5],[10]] | |
y = [27, 11, 75, 155] | |
LinearRegression = linear_model.LinearRegression() | |
LinearRegression = LinearRegression.fit(x,y) | |
plt.scatter(x,y) | |
plt.show() | |
predicted = LinearRegression.predict([[8]]) | |
plt.scatter(x,y) | |
plt.scatter(8, predicted, c='red') | |
plt.show() | |
print(predicted) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment