聚烯烃图片报告预测保留整数,相关性保留两位小数
This commit is contained in:
parent
ff7b9bf235
commit
fc05840cf8
@ -835,7 +835,7 @@ def convert_df_to_pydantic_pp(df_predict, model_id_name_dict, global_config):
|
|||||||
if c not in ['ds', 'created_dt']:
|
if c not in ['ds', 'created_dt']:
|
||||||
data['model_id'] = reverse_model_id_name_dict[c]
|
data['model_id'] = reverse_model_id_name_dict[c]
|
||||||
data['predicted_price'] = Decimal(
|
data['predicted_price'] = Decimal(
|
||||||
round(df_predict[c].values[0], 2))
|
int(df_predict[c].values[0]))
|
||||||
result = PpPredictionResult(**data)
|
result = PpPredictionResult(**data)
|
||||||
results.append(result)
|
results.append(result)
|
||||||
return results
|
return results
|
||||||
@ -959,7 +959,7 @@ def find_best_models(date='', global_config=None):
|
|||||||
ciridate = last_trading_day_str
|
ciridate = last_trading_day_str
|
||||||
global_config['logger'].info(f'计算预测{last_trading_day}的次日{last_trading_day}最佳模型')
|
global_config['logger'].info(f'计算预测{last_trading_day}的次日{last_trading_day}最佳模型')
|
||||||
global_config['logger'].info(
|
global_config['logger'].info(
|
||||||
f'{date}真实价格:{true_price[true_price["ds"] == date]["y"].values[0]}')
|
f'{date}真实价格:{true_price[true_price["ds"] == last_trading_day_str]["y"].values[0]}')
|
||||||
price = df[['data_date', wd, 'model_id']]
|
price = df[['data_date', wd, 'model_id']]
|
||||||
price = price[(price['data_date'] == ciridate)
|
price = price[(price['data_date'] == ciridate)
|
||||||
| (price['data_date'] == date)]
|
| (price['data_date'] == date)]
|
||||||
@ -1098,7 +1098,7 @@ def plot_pp_predict_result(y_hat, global_config,wd='yuedu'):
|
|||||||
y = pd.read_csv('juxitingdataset/指标数据.csv')[['ds', 'y']][-30:]
|
y = pd.read_csv('juxitingdataset/指标数据.csv')[['ds', 'y']][-30:]
|
||||||
xgx_df = pd.read_csv('juxitingdataset/相关系数.csv')
|
xgx_df = pd.read_csv('juxitingdataset/相关系数.csv')
|
||||||
xgx_df = xgx_df.rename(columns={xgx_df.columns[0]: '指标', xgx_df.columns[1]: '系数'})
|
xgx_df = xgx_df.rename(columns={xgx_df.columns[0]: '指标', xgx_df.columns[1]: '系数'})
|
||||||
top_10_correlations = xgx_df.sort_values(by='系数',ascending=False)[1:11]
|
top_10_correlations = xgx_df.sort_values(by='系数', ascending=False)[1:11].round().astype({'系数': int})
|
||||||
y['ds'] = pd.to_datetime(y['ds'])
|
y['ds'] = pd.to_datetime(y['ds'])
|
||||||
y = y[y['ds'] < y_hat['ds'].iloc[0]]
|
y = y[y['ds'] < y_hat['ds'].iloc[0]]
|
||||||
|
|
||||||
@ -1138,7 +1138,7 @@ def plot_pp_predict_result(y_hat, global_config,wd='yuedu'):
|
|||||||
'next_march_price': '次三月', 'next_april_price': '次四月',
|
'next_march_price': '次三月', 'next_april_price': '次四月',
|
||||||
}, inplace=True)
|
}, inplace=True)
|
||||||
columns = y_hat.columns.tolist()
|
columns = y_hat.columns.tolist()
|
||||||
data = y_hat.values.tolist()
|
data = [round(num) for num in y_hat.values.ravel().tolist()]
|
||||||
|
|
||||||
# 将日期转换为字符串格式
|
# 将日期转换为字符串格式
|
||||||
for row in data:
|
for row in data:
|
||||||
|
@ -557,7 +557,7 @@ if __name__ == '__main__':
|
|||||||
# except Exception as e:
|
# except Exception as e:
|
||||||
# logger.info(f'预测失败:{e}')
|
# logger.info(f'预测失败:{e}')
|
||||||
# continue
|
# continue
|
||||||
global_config['end_time'] = '2025-08-04'
|
# global_config['end_time'] = '2025-08-05'
|
||||||
predict_main()
|
predict_main()
|
||||||
|
|
||||||
# global_config['end_time'] = '2025-08-01'
|
# global_config['end_time'] = '2025-08-01'
|
||||||
|
@ -530,12 +530,13 @@ if __name__ == '__main__':
|
|||||||
# logger.info(f'预测失败:{e}')
|
# logger.info(f'预测失败:{e}')
|
||||||
# continue
|
# continue
|
||||||
|
|
||||||
global_config['end_time'] = '2025-08-04'
|
# global_config['end_time'] = '2025-08-05'
|
||||||
predict_main()
|
# predict_main()
|
||||||
# push_market_value()
|
# push_market_value()
|
||||||
|
# sql_inset_predict(global_config)
|
||||||
|
|
||||||
# 图片报告
|
# 图片报告
|
||||||
# global_config['end_time'] = '2025-07-31'
|
global_config['end_time'] = '2025-08-05'
|
||||||
# logger.info('图片报告ing')
|
logger.info('图片报告ing')
|
||||||
# pp_bdwd_png(global_config=global_config)
|
pp_bdwd_png(global_config=global_config)
|
||||||
# logger.info('图片报告end')
|
logger.info('图片报告end')
|
||||||
|
@ -513,7 +513,7 @@ if __name__ == '__main__':
|
|||||||
# continue
|
# continue
|
||||||
|
|
||||||
|
|
||||||
global_config['end_time'] = '2025-08-04'
|
global_config['end_time'] = '2025-08-05'
|
||||||
predict_main()
|
predict_main()
|
||||||
|
|
||||||
|
|
||||||
|
@ -396,7 +396,7 @@ def ex_Model_Juxiting(df, horizon, input_size, train_steps, val_check_steps, ear
|
|||||||
|
|
||||||
# VanillaTransformer(h=horizon, input_size=input_size, max_steps=train_steps, val_check_steps=val_check_steps, scaler_type='standard', ), //报错了
|
# VanillaTransformer(h=horizon, input_size=input_size, max_steps=train_steps, val_check_steps=val_check_steps, scaler_type='standard', ), //报错了
|
||||||
# Autoformer(h=horizon, input_size=input_size, max_steps=train_steps, val_check_steps=val_check_steps, scaler_type='standard', ), //报错了
|
# Autoformer(h=horizon, input_size=input_size, max_steps=train_steps, val_check_steps=val_check_steps, scaler_type='standard', ), //报错了
|
||||||
# NBEATS(h=horizon, input_size=input_size, max_steps=train_steps, val_check_steps=val_check_steps, scaler_type='standard', ),
|
NBEATS(h=horizon, input_size=input_size, max_steps=train_steps, val_check_steps=val_check_steps, scaler_type='standard', ),
|
||||||
# NBEATSx (h=horizon, input_size=input_size, max_steps=train_steps, val_check_steps=val_check_steps, scaler_type='standard',activation='ReLU', ), //报错
|
# NBEATSx (h=horizon, input_size=input_size, max_steps=train_steps, val_check_steps=val_check_steps, scaler_type='standard',activation='ReLU', ), //报错
|
||||||
# HINT(h=horizon),
|
# HINT(h=horizon),
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user