Skip to content

Instantly share code, notes, and snippets.

@nithyadurai87
Created September 24, 2018 12:30
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 nithyadurai87/a39ecee72dc4a266933621c298e80df9 to your computer and use it in GitHub Desktop.
Save nithyadurai87/a39ecee72dc4a266933621c298e80df9 to your computer and use it in GitHub Desktop.
from sklearn.linear_model import LinearRegression
import numpy as np
from numpy.linalg import inv,lstsq
from numpy import dot, transpose
x = [[6], [8], [10], [14], [18]]
y = [[7], [9], [13], [17.5], [18]]
model = LinearRegression()
model.fit(x,y)
x_test = [[8], [9], [11], [16], [12]]
y_test = [[11], [8.5], [15], [18], [11]]
print ("Score = ",model.score(x_test, y_test))
@PALANIVELAADHI
Copy link

Very usefull for beginers mam...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment