Last active
May 25, 2020 14:26
-
-
Save Eserthesay/c9d5f3de9a7af413f7ae27d0d653bee4 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
from sklearn.datasets import make_regression | |
import matplotlib.pyplot as plt | |
%matplotlib inline | |
#generating random dataset for linear regression | |
x,y,coef=make_regression(n_samples=10,n_features=1,n_informative=1,n_targets=1,noise= | |
3,bias=1.0,coef=True,random_state=42) | |
#modelling | |
from sklearn.linear_model import LinearRegression | |
model=LinearRegression(fit_intercept=False) | |
model.fit(x,y) | |
y_pred=model.predict(x) | |
#plot | |
plt.scatter(y,y_pred) | |
plt.plot(y,y,color='r') | |
plt.show () |
Hey, just updated the code. Feel free the run in ur notebook.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, is it possible to execute this code with a sample of data online ?