Linear Regression Python Sklearn Numpy P PDF
Linear Regression Python Sklearn Numpy P PDF
In [5]: raw_data = pd.read_csv("linear.csv") #any dataset will work. You can get the data from my github
# https://github.com/mGalarnyk/Linear_Regression
raw_data.head(3)
Out[5]: x y
0 82.583220 134.907414
1 73.922466 134.085180
2 34.887445 NaN
Out[6]: x y
0 82.583220 134.907414
1 73.922466 134.085180
3 61.839983 114.530638
1
In [8]: plt.scatter(X,Y, color=’blue’)
plt.plot([0,100],[b,m*100+b],’r’)
plt.title(’Linear Regression Example’, fontsize = 20)
plt.xlabel(’X’, fontsize = 15)
plt.ylabel(’Y’, fontsize = 15)
1 official documentation
http://scikit-learn.org/stable/auto examples/linear model/plot ols.html