Browse Source

继续测试

yufeng 4 years ago
parent
commit
5654bb6499
6 changed files with 44 additions and 42 deletions
  1. 4 4
      mix/mix_predict_190.py
  2. 2 2
      mix/mix_predict_200.py
  3. 1 1
      mix/mix_predict_by_day_190.py
  4. 17 17
      mix/mix_train_190.py
  5. 15 14
      mix/mix_train_200.py
  6. 5 4
      mix/mix_train_300.py

+ 4 - 4
mix/mix_predict_190.py

@@ -40,11 +40,11 @@ def _score(fact, line):
40 40
 def predict(file_path='', model_path='15min_dnn_seq.h5', idx=-1):
41 41
     test_x,test_y,lines=read_data(file_path)
42 42
 
43
-    test_x_a = test_x[:,:18*18]
44
-    test_x_a = test_x_a.reshape(test_x.shape[0], 18, 18, 1)
43
+    test_x_a = test_x[:,:18*20]
44
+    test_x_a = test_x_a.reshape(test_x.shape[0], 18, 20, 1)
45 45
     # test_x_b = test_x[:, 9*26:9*26+9*26]
46 46
     # test_x_b = test_x_b.reshape(test_x.shape[0], 9, 26, 1)
47
-    test_x_c = test_x[:,18*18:]
47
+    test_x_c = test_x[:,18*20:]
48 48
 
49 49
     model=load_model(model_path)
50 50
     score = model.evaluate([test_x_c, test_x_a,], test_y)
@@ -96,7 +96,7 @@ def predict(file_path='', model_path='15min_dnn_seq.h5', idx=-1):
96 96
 
97 97
 if __name__ == '__main__':
98 98
     # predict(file_path='D:\\data\\quantization\\stock181_18d_test.log', model_path='181_18d_mix_6D_ma5_s_seq.h5')
99
-    predict(file_path='D:\\data\\quantization\\stock196_18d_train1.log', model_path='196_18d_mix_6D_ma5_s_seq.h5')
99
+    predict(file_path='D:\\data\\quantization\\stock199A_18d_train1.log', model_path='199A_18d_mix_5D_ma5_s_seq.h5')
100 100
     # predict(file_path='D:\\data\\quantization\\stock6_test.log', model_path='15m_dnn_seq.h5')
101 101
     # multi_predict(model='15_18d')
102 102
     # predict_today(20200229, model='11_18d')

+ 2 - 2
mix/mix_predict_200.py

@@ -90,8 +90,8 @@ def predict(file_path='', model_path='15min_dnn_seq.h5', idx=-1, row=18, col=20)
90 90
 
91 91
 if __name__ == '__main__':
92 92
     # predict(file_path='D:\\data\\quantization\\stock181_18d_test.log', model_path='181_18d_mix_6D_ma5_s_seq.h5')
93
-    predict(file_path='D:\\data\\quantization\\stock215_18d_train1.log', model_path='215_18d_mix_6D_ma5_s_seq.h5', row=18, col=20)
94
-    # predict(file_path='D:\\data\\quantization\\stock310_28d_train1.log', model_path='310_28d_mix_6D_ma5_s_seq.h5', row=28, col=18)
93
+    predict(file_path='D:\\data\\quantization\\stock217_18d_train1.log', model_path='217_18d_mix_5D_ma5_s_seq.h5', row=18, col=18)
94
+    # predict(file_path='D:\\data\\quantization\\stock321_28d_train1.log', model_path='321_28d_mix_6D_ma5_s_seq.h5', row=28, col=20)
95 95
     # predict(file_path='D:\\data\\quantization\\stock6_test.log', model_path='15m_dnn_seq.h5')
96 96
     # multi_predict(model='15_18d')
97 97
     # predict_today(20200229, model='11_18d')

+ 1 - 1
mix/mix_predict_by_day_190.py

@@ -82,5 +82,5 @@ if __name__ == '__main__':
82 82
     # predict(file_path='D:\\data\\quantization\\stock9_18_2.log', model_path='18d_dnn_seq.h5')
83 83
     # predict(file_path='D:\\data\\quantization\\stock16_18d_20200310.log', model_path='16_18d_mix_seq')
84 84
     # predict(file_path='D:\\data\\quantization\\stock196_18d_20200326.log', model_path='196_18d_mix_6D_ma5_s_seq')
85
-    predict(file_path='D:\\data\\quantization\\stock311_28d_20191211.log', model_path='311_28d_mix_6D_ma5_s_seq', rows=28, cols=20)
85
+    predict(file_path='D:\\data\\quantization\\stock321_28d_5D_20200327.log', model_path='321_28d_mix_6D_ma5_s_seq', rows=28, cols=20)
86 86
     # predict(file_path='D:\\data\\quantization\\stock9_18_4.log', model_path='18d_dnn_seq.h5')

+ 17 - 17
mix/mix_train_190.py

@@ -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...")

+ 15 - 14
mix/mix_train_200.py

@@ -18,11 +18,11 @@ from keras.callbacks import EarlyStopping
18 18
 
19 19
 early_stopping = EarlyStopping(monitor='accuracy', patience=5, verbose=2)
20 20
 
21
-epochs= 68
21
+epochs= 60
22 22
 size = 420000 #18W 60W
23
-file_path = 'D:\\data\\quantization\\stock215_18d_train2.log'
24
-model_path = '215_18d_mix_6D_ma5_s_seq.h5'
25
-file_path1='D:\\data\\quantization\\stock215_18d_test.log'
23
+file_path = 'D:\\data\\quantization\\stock217_18d_train2.log'
24
+model_path = '217_18d_mix_5D_ma5_s_seq.h5'
25
+file_path1='D:\\data\\quantization\\stock217_18d_test.log'
26 26
 '''
27 27
 ROC
28 28
 0大盘涨停 涨停/跌停/创业板涨停跌停     42,97,45    43,97,36 
@@ -42,9 +42,10 @@ ROC
42 42
 beta+4+3                                           49,96,37
43 43
 beta+2+5                                           52,96,38
44 44
 
45
-15 流通市值>30
46
-                                                   54,97,33
47
-
45
+15 流通市值>30                                     54,97,33
46
+                                                   
47
+16 流通市值>30 + 5d                                59,98,26
48
+17 roc放后面, 18*18                                57,97,29
48 49
 '''
49 50
 
50 51
 def read_data(path, path1=file_path1):
@@ -82,11 +83,11 @@ def read_data(path, path1=file_path1):
82 83
 
83 84
 train_x,train_y,test_x,test_y=read_data(file_path)
84 85
 
85
-train_x_a = train_x[:,:18*20]
86
-train_x_a = train_x_a.reshape(train_x.shape[0], 18, 20, 1)
86
+train_x_a = train_x[:,:18*18]
87
+train_x_a = train_x_a.reshape(train_x.shape[0], 18, 18, 1)
87 88
 # train_x_b = train_x[:, 9*26:18*26]
88 89
 # train_x_b = train_x_b.reshape(train_x.shape[0], 9, 26, 1)
89
-train_x_c = train_x[:,18*20:]
90
+train_x_c = train_x[:,18*18:]
90 91
 
91 92
 
92 93
 def create_mlp(dim, regress=False):
@@ -150,7 +151,7 @@ def create_cnn(width, height, depth, size=48, kernel_size=(5, 6), regress=False,
150 151
 # create the MLP and CNN models
151 152
 mlp = create_mlp(train_x_c.shape[1], regress=False)
152 153
 # cnn_0 = create_cnn(18, 20, 1, kernel_size=(3, 3), size=90, regress=False, output=96)       # 31 97 46
153
-cnn_0 = create_cnn(18, 20, 1, kernel_size=(6, 20), size=96, regress=False, output=96)         # 29 98 47
154
+cnn_0 = create_cnn(18, 18, 1, kernel_size=(6, 20), size=96, regress=False, output=99)         # 29 98 47
154 155
 # cnn_0 = create_cnn(18, 20, 1, kernel_size=(9, 9), size=90, regress=False, output=96)         # 28 97 53
155 156
 # cnn_0 = create_cnn(18, 20, 1, kernel_size=(3, 20), size=90, regress=False, output=96)
156 157
 # cnn_1 = create_cnn(18, 20, 1, kernel_size=(18, 10), size=80, regress=False, output=96)
@@ -200,11 +201,11 @@ model.fit(
200 201
 
201 202
 model.save(model_path)
202 203
 
203
-test_x_a = test_x[:,:18*20]
204
-test_x_a = test_x_a.reshape(test_x.shape[0], 18, 20, 1)
204
+test_x_a = test_x[:,:18*18]
205
+test_x_a = test_x_a.reshape(test_x.shape[0], 18, 18, 1)
205 206
 # test_x_b = test_x[:, 9*26:9*26+9*26]
206 207
 # test_x_b = test_x_b.reshape(test_x.shape[0], 9, 26, 1)
207
-test_x_c = test_x[:,18*20:]
208
+test_x_c = test_x[:,18*18:]
208 209
 
209 210
 # make predictions on the testing data
210 211
 print("[INFO] predicting house prices...")

+ 5 - 4
mix/mix_train_300.py

@@ -20,9 +20,9 @@ early_stopping = EarlyStopping(monitor='accuracy', patience=5, verbose=2)
20 20
 
21 21
 epochs= 88
22 22
 size = 410000 #18W 60W
23
-file_path = 'D:\\data\\quantization\\stock311_28d_train2.log'
24
-model_path = '311_28d_mix_6D_ma5_s_seq.h5'
25
-file_path1='D:\\data\\quantization\\stock311_28d_test.log'
23
+file_path = 'D:\\data\\quantization\\stock321_28d_train2.log'
24
+model_path = '321_28d_mix_6D_ma5_s_seq.h5'
25
+file_path1='D:\\data\\quantization\\stock321_28d_test.log'
26 26
 row = 28
27 27
 col = 20
28 28
 '''
@@ -35,7 +35,8 @@ col = 20
35 35
 10 ROC     28*18          36,100,18 
36 36
 11 DMI     28*20          37,101,16
37 37
 12 MACD    28*19           
38
- 
38
+28d+ma5+5+流通市值>10
39
+21 DMI     28*20          43,101,11  非常好
39 40
  
40 41
        
41 42
 30d+close