parkerjj commited on
Commit
45bfe40
1 Parent(s): a5b4b9a

优化预测函数,修正获取最后一天指数值的逻辑,移除冗余代码

Browse files
Files changed (1) hide show
  1. blkeras.py +6 -6
blkeras.py CHANGED
@@ -226,6 +226,12 @@ def predict(text: str, stock_codes: list):
226
  #print("Stock Predictions:", stock_predictions)
227
 
228
 
 
 
 
 
 
 
229
 
230
  # 针对 1012 模型的修复
231
  stock_predictions = stock_fix_for_1012_model(float(X_sentiment[0][0]), stock_predictions[0], previous_stock_history[0][-1][0])
@@ -242,12 +248,6 @@ def predict(text: str, stock_codes: list):
242
 
243
 
244
 
245
- # 获取 index_feature 中最后一天的第一个值
246
- last_index_inx_value = previous_stock_inx_index_history[-1][0]
247
- last_index_dj_value = previous_stock_dj_index_history[-1][0]
248
- last_index_ixic_value = previous_stock_ixic_index_history[-1][0]
249
- last_index_ndx_value = previous_stock_ndx_index_history[-1][0]
250
-
251
  # 提取 Index Predictions 中每一天的第一个值
252
  index_inx_day_1 = index_inx_predictions[0][0]
253
  index_inx_day_2 = index_inx_predictions[1][0]
 
226
  #print("Stock Predictions:", stock_predictions)
227
 
228
 
229
+ # 获取 index_feature 中最后一天的第一个值
230
+ last_index_inx_value = previous_stock_inx_index_history[0][-1][0]
231
+ last_index_dj_value = previous_stock_dj_index_history[0][-1][0]
232
+ last_index_ixic_value = previous_stock_ixic_index_history[0][-1][0]
233
+ last_index_ndx_value = previous_stock_ndx_index_history[0][-1][0]
234
+
235
 
236
  # 针对 1012 模型的修复
237
  stock_predictions = stock_fix_for_1012_model(float(X_sentiment[0][0]), stock_predictions[0], previous_stock_history[0][-1][0])
 
248
 
249
 
250
 
 
 
 
 
 
 
251
  # 提取 Index Predictions 中每一天的第一个值
252
  index_inx_day_1 = index_inx_predictions[0][0]
253
  index_inx_day_2 = index_inx_predictions[1][0]