|
@@ -18,22 +18,22 @@ from keras.callbacks import EarlyStopping
|
18
|
18
|
|
19
|
19
|
early_stopping = EarlyStopping(monitor='accuracy', patience=5, verbose=2)
|
20
|
20
|
|
21
|
|
-epochs= 88
|
|
21
|
+epochs= 90
|
22
|
22
|
size = 400000 #18W 60W
|
23
|
|
-file_path = 'D:\\data\\quantization\\stock196_18d_train2.log'
|
24
|
|
-model_path = '196A_18d_mix_6D_ma5_s_seq.h5'
|
25
|
|
-file_path1='D:\\data\\quantization\\stock196_18d_test.log'
|
|
23
|
+file_path = 'D:\\data\\quantization\\stock199A_18d_train2.log'
|
|
24
|
+model_path = '199A_18d_mix_5D_ma5_s_seq.h5'
|
|
25
|
+file_path1='D:\\data\\quantization\\stock199A_18d_test.log'
|
26
|
26
|
|
27
|
27
|
'''
|
28
|
28
|
大盘预测
|
29
|
29
|
结果均用使用ma
|
30
|
30
|
6 ROC cnn18*18 37,99,28
|
31
|
|
-7 ROC + 窗口6*18+ cnn18*18
|
32
|
|
-8 after用5日
|
33
|
|
-9 after5 + roc in before
|
34
|
|
-9A after5 + roc in before + beta
|
35
|
|
-9B after5 + roc in before + beta + 其他信息
|
36
|
|
-
|
|
31
|
+7 ROC + 窗口6*18+ cnn18*18 36,99,27
|
|
32
|
+8 after用5日 40,99,22
|
|
33
|
+9 after5 + roc in before 18*20 40,99,23
|
|
34
|
+9A after5 + roc in before + beta 40,100,21
|
|
35
|
+9B after5 + roc in before + beta + 其他信息
|
|
36
|
+9C 流通>5
|
37
|
37
|
'''
|
38
|
38
|
|
39
|
39
|
def read_data(path, path1=file_path1):
|
|
@@ -71,11 +71,11 @@ def read_data(path, path1=file_path1):
|
71
|
71
|
|
72
|
72
|
train_x,train_y,test_x,test_y=read_data(file_path)
|
73
|
73
|
|
74
|
|
-train_x_a = train_x[:,:18*18]
|
75
|
|
-train_x_a = train_x_a.reshape(train_x.shape[0], 18, 18, 1)
|
|
74
|
+train_x_a = train_x[:,:18*20]
|
|
75
|
+train_x_a = train_x_a.reshape(train_x.shape[0], 18, 20, 1)
|
76
|
76
|
# train_x_b = train_x[:, 9*26:18*26]
|
77
|
77
|
# train_x_b = train_x_b.reshape(train_x.shape[0], 9, 26, 1)
|
78
|
|
-train_x_c = train_x[:,18*18:]
|
|
78
|
+train_x_c = train_x[:,18*20:]
|
79
|
79
|
|
80
|
80
|
|
81
|
81
|
def create_mlp(dim, regress=False):
|
|
@@ -141,7 +141,7 @@ mlp = create_mlp(train_x_c.shape[1], regress=False)
|
141
|
141
|
# cnn_0 = create_cnn(18, 21, 1, kernel_size=(3, 3), size=64, regress=False, output=128) # 31 97 46
|
142
|
142
|
# cnn_0 = create_cnn(18, 21, 1, kernel_size=(6, 6), size=64, regress=False, output=128) # 29 98 47
|
143
|
143
|
# cnn_0 = create_cnn(18, 21, 1, kernel_size=(9, 9), size=64, regress=False, output=128) # 28 97 53
|
144
|
|
-cnn_0 = create_cnn(18, 18, 1, kernel_size=(6, 18), size=96, regress=False, output=128) #A23 99 33 A' 26 99 36 #B 34 98 43
|
|
144
|
+cnn_0 = create_cnn(18, 20, 1, kernel_size=(6, 20), size=96, regress=False, output=128) #A23 99 33 A' 26 99 36 #B 34 98 43
|
145
|
145
|
# cnn_1 = create_cnn(18, 21, 1, kernel_size=(18, 11), size=96, regress=False, output=96)
|
146
|
146
|
# cnn_1 = create_cnn(9, 26, 1, kernel_size=(2, 14), size=36, regress=False, output=64)
|
147
|
147
|
|
|
@@ -186,11 +186,11 @@ model.fit(
|
186
|
186
|
|
187
|
187
|
model.save(model_path)
|
188
|
188
|
|
189
|
|
-test_x_a = test_x[:,:18*18]
|
190
|
|
-test_x_a = test_x_a.reshape(test_x.shape[0], 18, 18, 1)
|
|
189
|
+test_x_a = test_x[:,:18*20]
|
|
190
|
+test_x_a = test_x_a.reshape(test_x.shape[0], 18, 20, 1)
|
191
|
191
|
# test_x_b = test_x[:, 9*26:9*26+9*26]
|
192
|
192
|
# test_x_b = test_x_b.reshape(test_x.shape[0], 9, 26, 1)
|
193
|
|
-test_x_c = test_x[:,18*18:]
|
|
193
|
+test_x_c = test_x[:,18*20:]
|
194
|
194
|
|
195
|
195
|
# make predictions on the testing data
|
196
|
196
|
print("[INFO] predicting house prices...")
|