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