-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathadaptative_normalizer.py
76 lines (47 loc) · 2.39 KB
/
adaptative_normalizer.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
from datetime import datetime
import pandas
from processing import *
TRAIN_SIZE = 30
TARGET_TIME = 1
LAG_SIZE = 1
EMB_SIZE = 1
#USD-BRL
dataframe = pandas.read_csv('minidolar/wdo.csv', sep = '|', engine='python', decimal='.',header=0)
dataset = dataframe['fechamento']
ori = dataset
media = dataframe['media'].tolist()
dataset = [100 * (b - a) / a for a, b in zip(dataset[::1], dataset[1::1])]
dataset = pandas.DataFrame(dataset)
ewm_dolar = dataset.ewm(span=5, min_periods=5).mean()
#removendo NaN
dataset = np.array(dataset.iloc[4:])
ewm_dolar = np.array(ewm_dolar.iloc[4:])
ori = np.array(ori.iloc[4:])
X_train, X_test, Y_train, Y_test, scaler, shift_train, shift_test, X_trainp, X_testp, Y_trainp, Y_testp = nn_an_type(dataset, ewm_dolar, TRAIN_SIZE,TARGET_TIME, LAG_SIZE, 'o')
#X, Y = split_into_chunks(dataset, TRAIN_SIZE, TARGET_TIME, LAG_SIZE, binary=False, scale=False)
#X, Y = np.array(X), np.array(Y)
#X_train_, X_test_, Y_train_, Y_test_ = create_Xt_Yt(X, Y, percentage=0.80)
#X_train, X_test, Y_train, Y_test, scaler, shift_train, shift_test, X_trainp, X_testp, Y_trainp, Y_testp = nn_an(dataset, ewm_dolar, TRAIN_SIZE,TARGET_TIME, LAG_SIZE)
#X_train2, X_test2, Y_train2, Y_test2, scaler_train2, scaler_test2, X_trainp, X_testp, Y_trainp, Y_testp = nn_sw(dataset,TRAIN_SIZE,TARGET_TIME, LAG_SIZE)
#X_trainp2, X_testp2, Y_trainp2, Y_testp2 = nn_an_den(X_train, X_test, Y_train, Y_test, scaler, shift_train, shift_test)
#X_trainp3, X_testp3, Y_trainp3, Y_testp3 = nn_sw_den(X_train2, X_test2, Y_train2, Y_test2, scaler_train2, scaler_test2)
# X_train, X_test, Y_train, Y_test, maximum = nn_ds(dataset, TRAIN_SIZE, TARGET_TIME, LAG_SIZE)
#
# X_train, X_test, Y_train, Y_test = nn_ds_den(X_train, X_test, Y_train, Y_test, maximum)
#import matplotlib.pyplot as plt
#plt.plot(dataset_norm)
#BTC-USD
btc = pandas.read_csv('btc-usd.csv', sep = ',', engine='python', decimal='.',header=0)
dataset_btc = btc['close']
ewm_btc = dataset_btc.ewm(span=5, min_periods=5).mean()
#removendo NaN
dataset_btc = dataset_btc.iloc[4:]
ewm_btc = ewm_btc.iloc[4:]
#print(dataset_btc)
#
# nn_sw(dataset, TRAIN_SIZE,TARGET_TIME,LAG_SIZE)
#
# X_train, X_test, Y_train, Y_test, scaler_train, scaler_test, shift_train, shift_test = nn_an(dataset, ewm_dolar, TRAIN_SIZE, TARGET_TIME, LAG_SIZE)
#
#
# X_train, X_test, Y_train, Y_test = nn_an_den(X_train, X_test, Y_train, Y_test, scaler_train, scaler_test, shift_train, shift_test)