質問編集履歴
1
前処理を加えました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -51,6 +51,43 @@
|
|
51
51
|
model = tf.keras.Model(inputs,outputs)
|
52
52
|
```
|
53
53
|
|
54
|
+
全処理になります。
|
55
|
+
```python
|
56
|
+
f = "AUDUSDM_15.csv"
|
57
|
+
|
58
|
+
df = pd.read_csv(f)
|
59
|
+
price_name = "Close"
|
60
|
+
x = df[[price_name]]
|
61
|
+
y = df[[price_name]]
|
62
|
+
|
63
|
+
|
64
|
+
fit = preprocessing.MinMaxScaler().fit(y)
|
65
|
+
x = preprocessing.MinMaxScaler().fit_transform(x)
|
66
|
+
y = fit.transform(y)
|
67
|
+
# x = np.asanyarray(x)
|
68
|
+
# y = np.asanyarray(y)
|
69
|
+
num_nits = 20
|
70
|
+
s = 1
|
71
|
+
gen1 = tf.keras.preprocessing.sequence.TimeseriesGenerator(x,y,num_nits,stride=1, batch_size=3000)
|
72
|
+
x = []
|
73
|
+
y = []
|
74
|
+
for i in range(len(gen1)):
|
75
|
+
xx,yy = gen1[i]
|
76
|
+
xx,yy = xx.tolist(),yy.tolist()
|
77
|
+
x.extend(xx)
|
78
|
+
y.extend(yy)
|
79
|
+
|
80
|
+
# del x[0]
|
81
|
+
# del y[-1]
|
82
|
+
|
83
|
+
x = np.asanyarray(x)
|
84
|
+
y = np.asanyarray(y)
|
85
|
+
|
86
|
+
xx = x[0:-130,]
|
87
|
+
yy = y[0:-130,]
|
88
|
+
train_x,test_x,train_y,test_y = train_test_split(xx,yy,test_size=0.2, shuffle =True)
|
89
|
+
```
|
90
|
+
|
54
91
|
### 試したこと
|
55
92
|
|
56
93
|
ここに問題に対して試したことを記載してください。
|