Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. import pandas as pd
  2. import matplotlib.pyplot as plt
  3. import numpy as np
  4.  
  5. df = pd.read_csv("bogu.csv",sep = ";")
  6.  
  7. plt.scatter(df.resim,df.katsayi)
  8. plt.xlabel("resim")
  9. plt.ylabel("katsayi")
  10. #plt.show()
  11. if df.resim[1:37].values:
  12. plt.scatter(x,color="red")
  13.  
  14.  
  15. #%% sklearn
  16.  
  17. from sklearn.linear_model import LinearRegression
  18. linear_reg=LinearRegression()
  19. x = df.iloc[1:,0].values.reshape(-1,1)
  20. y = df.iloc[1:,1].values.reshape(-1,1)
  21. x = x.astype(np.float)
  22. y = y.astype(np.float)
  23. linear_reg.fit(x,y)
  24. #array=np.array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]).reshape(-1,1) # deneyim
  25. #plt.scatter(x,y)
  26. y_head=linear_reg.predict(x)
  27. plt.plot(x,y_head,color="red",label="linear")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement