Skip to content

Instantly share code, notes, and snippets.

@Eserthesay
Last active May 25, 2020 14:26
Show Gist options
  • Save Eserthesay/c9d5f3de9a7af413f7ae27d0d653bee4 to your computer and use it in GitHub Desktop.
Save Eserthesay/c9d5f3de9a7af413f7ae27d0d653bee4 to your computer and use it in GitHub Desktop.
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 ()
@Developer1Dev
Copy link

Hi, is it possible to execute this code with a sample of data online ?

@Eserthesay
Copy link
Author

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