-
Notifications
You must be signed in to change notification settings - Fork 1
/
coordinate.py
56 lines (43 loc) · 1.37 KB
/
coordinate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import statsmodels.api as sm
def ML():
veriler = pd.read_csv('koordinat.csv')
#pd.read_csv("veriler.csv")
#veri on isleme
aylar = veriler[['Frame']]
#test
print(aylar)
satislar = veriler[['Kuzey']]
print(satislar)
#verilerin egitim ve test icin bolunmesi
from sklearn.model_selection import train_test_split
x_train, x_test,y_train,y_test = train_test_split(aylar,satislar,test_size=0.33, random_state=0)
'''
#verilerin olceklenmesi
from sklearn.preprocessing import StandardScaler
sc = StandardScaler()
X_train = sc.fit_transform(x_train)
X_test = sc.fit_transform(x_test)
Y_train = sc.fit_transform(y_train)
Y_test = sc.fit_transform(y_test)
'''
# model inşası (linear regression)
from sklearn.linear_model import LinearRegression
lr = LinearRegression()
lr.fit(x_train,y_train)
tahmin = lr.predict(x_test)
x_train = x_train.sort_index()
y_train = y_train.sort_index()
model=sm.OLS(lr.predict(x_train),x_train)
print(model.fit().summary())
plt.plot(x_train,y_train)
plt.plot(x_test,lr.predict(x_test))
plt.title("KOordinat for every Frame")
plt.xlabel("Frame")
plt.ylabel("KOordinat")
plt.savefig('resultt.png')
return tahmin