Created
February 9, 2020 17:54
-
-
Save clementpoiret/3ba423b6a54a4627f2eeafdaf0cccf8d 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
# Model's Definition and Training | |
model = LinearRegression(fit_intercept = True) | |
model.fit(X_train, y_train) | |
# Creating test sets | |
X_test = 2 * np.random.random_sample((10, 1)) | |
y_test = gradient * X_test + w0 + 0.1 * np.random.random_sample((10, 1)) | |
# Score | |
r2 = model.score(X_test, y_test) | |
print("Gradient : {}\nBias w0 : {}\nR2 : {}".format(model.coef_, | |
model.intercept_, | |
r2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment