聚烯烃日度调试

This commit is contained in:
workpc 2025-08-12 17:10:07 +08:00
parent fc1c97e4bb
commit 61ba82f177
4 changed files with 46 additions and 28 deletions

View File

@ -257,14 +257,17 @@ ClassifyId = 1161
# # 八大维度数据项编码
# bdwd_items = {
# 'ciri': '91371600MAC3TYFN6M|LSBM00007|FORECAST_PRICE',
# 'benzhou': '91371600MAC3TYFN6M|LSBM00007|FORECAST_PRICE01',
# 'cizhou': '91371600MAC3TYFN6M|LSBM00007|FORECAST_PRICE02',
# 'gezhou': '91371600MAC3TYFN6M|LSBM00007|FORECAST_PRICE03',
# 'ciyue': '91371600MAC3TYFN6M|LSBM00007|FORECAST_PRICE04',
# 'cieryue': '91371600MAC3TYFN6M|LSBM00007|FORECAST_PRICE05',
# 'cisanyue': '91371600MAC3TYFN6M|LSBM00007|FORECAST_PRICE06',
# 'cisiyue': '91371600MAC3TYFN6M|LSBM00007|FORECAST_PRICE07',
# 'ciri': '251889263|FORECAST|PRICE|T01',
# 'cierri': '251889263|FORECAST|PRICE|T02',
# 'cisanri': '251889263|FORECAST|PRICE|T03',
# 'cisiri': '251889263|FORECAST|PRICE|T04',
# 'benzhou': '251889263|FORECAST|PRICE|T05',
# 'cizhou': '251889263|FORECAST|PRICE|W_01',
# 'gezhou': '251889263|FORECAST|PRICE|W_02',
# 'ciyue': '251889263|FORECAST|PRICE|M_01',
# 'cieryue': '251889263|FORECAST|PRICE|M_02',
# 'cisanyue': '251889263|FORECAST|PRICE|M_03',
# 'cisiyue': '251889263|FORECAST|PRICE|M_04',
# }
@ -440,9 +443,9 @@ is_timefurture = True # 是否使用时间特征
is_fivemodels = False # 是否使用之前保存的最佳的5个模型
is_edbcode = False # 特征使用edbcoding列表中的
is_edbnamelist = False # 自定义特征对应上面的edbnamelist
is_update_eta = False # 预测结果上传到eta
is_update_eta = True # 预测结果上传到eta
is_update_report = False # 是否上传报告
is_update_warning_data = False # 是否上传预警数据
is_update_warning_data = True # 是否上传预警数据
is_update_predict_value = True # 是否上传预测值到市场信息平台
is_del_corr = 0.6 # 是否删除相关性高的特征,取值为 0-1 0 为不删除0.6 表示删除相关性小于0.6的特征
is_del_tow_month = True # 是否删除两个月不更新的特征

View File

@ -521,8 +521,17 @@ def predict_main():
# logger.info('制作报告end')
push_market_value()
sql_inset_predict(global_config)
try:
push_market_value()
logger.info('推送市场值完成')
except Exception as e:
logger.info(f'推送市场值失败:{e}')
try:
sql_inset_predict(global_config)
logger.info('插入预测数据完成')
except Exception as e:
logger.info(f'插入预测数据失败:{e}')
# # LSTM 单变量模型
# ex_Lstm(df,input_seq_len=input_size,output_seq_len=horizon,is_debug=is_debug,dataset=dataset)
@ -549,16 +558,16 @@ def predict_main():
if __name__ == '__main__':
# global end_time
# 遍历2024-11-25 到 2024-12-3 之间的工作日日期
# for i_time in pd.date_range('2025-6-2', '2025-7-23', freq='B'):
# try:
# global_config['end_time'] = i_time.strftime('%Y-%m-%d')
# global_config['db_mysql'].connect()
# predict_main()
# except Exception as e:
# logger.info(f'预测失败:{e}')
# continue
for i_time in pd.date_range('2025-8-1', '2025-8-11', freq='B'):
try:
global_config['end_time'] = i_time.strftime('%Y-%m-%d')
global_config['db_mysql'].connect()
predict_main()
except Exception as e:
logger.info(f'预测失败:{e}')
continue
# global_config['end_time'] = '2025-08-05'
predict_main()
# predict_main()
# global_config['end_time'] = '2025-08-01'
# push_market_value()

View File

@ -552,12 +552,12 @@ if __name__ == '__main__':
# continue
# global_config['end_time'] = '2025-07-25'
predict_main()
# predict_main()
# push_market_value()
# sql_inset_predict(global_config)
# 图片报告
# global_config['end_time'] = '2025-08-05'
# logger.info('图片报告ing')
# pp_bdwd_png(global_config=global_config)
# logger.info('图片报告end')
global_config['end_time'] = '2025-08-12'
logger.info('图片报告ing')
pp_bdwd_png(global_config=global_config)
logger.info('图片报告end')

View File

@ -321,6 +321,8 @@ def ex_Model_Juxiting(df, horizon, input_size, train_steps, val_check_steps, ear
df['ds'] = pd.to_datetime(df['ds'], errors='coerce')
# df 数值列转为 float32
for col in df.select_dtypes(include=['int']).columns:
if col == 'ds':
continue
df[col] = df[col].astype(np.float32)
# 设置中文字体
@ -351,8 +353,12 @@ def ex_Model_Juxiting(df, horizon, input_size, train_steps, val_check_steps, ear
# 特征重要度
X_train = df_train.drop(columns=['y', 'ds'])
if 'yearmonthweeks' in df_train.columns:
X_train = df_train.drop(columns=['yearmonthweeks'])
if 'yearmonthweeks' in X_train.columns:
X_train = X_train.drop(columns=['yearmonthweeks'])
# 自动检测并删除所有datetime类型列
datetime_cols = X_train.select_dtypes(include=['datetime64']).columns
if not datetime_cols.empty:
X_train = X_train.drop(columns=datetime_cols)
y_train = df_train['y']
feature_importance(X_train=X_train, y_train=y_train)