From c7dac7586d84dc6ed778862bcb9b5ba099b5386c Mon Sep 17 00:00:00 2001 From: jingboyitiji Date: Fri, 28 Mar 2025 13:12:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BA=A6=E8=81=9A=E7=83=AF=E7=83=83?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=85=AB=E5=A4=A7=E7=BB=B4=E5=BA=A6=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config_juxiting.py | 34 ++++++++++++++++++++++++++++++++-- main_juxiting.py | 27 +++++++++++++++++---------- models/nerulforcastmodels.py | 26 +++++++++++++++----------- 3 files changed, 64 insertions(+), 23 deletions(-) diff --git a/config_juxiting.py b/config_juxiting.py index 502ac7d..d1cecc2 100644 --- a/config_juxiting.py +++ b/config_juxiting.py @@ -132,12 +132,17 @@ ClassifyId = 1161 # 变量定义--测试环境 -server_host = '192.168.100.53' - +server_host = '192.168.100.53' # 内网 +# server_host = '183.242.74.28' # 外网 login_pushreport_url = f"http://{server_host}:8080/jingbo-dev/api/server/login" +# 上传报告 upload_url = f"http://{server_host}:8080/jingbo-dev/api/analysis/reportInfo/researchUploadReportSave" +# 停更预警 upload_warning_url = f"http://{server_host}:8080/jingbo-dev/api/basicBuiness/crudeOilWarning/save" +# 查询数据项编码 query_data_list_item_nos_url = f"http://{server_host}:8080/jingbo-dev/api/warehouse/dwDataItem/queryDataListItemNos" +# 上传数据项值 +push_data_value_list_url = f"http://{server_host}:8080/jingbo-dev/api/dw/dataValue/pushDataValueList" login_data = { "data": { @@ -190,6 +195,31 @@ query_data_list_item_nos_data = { } } + +push_data_value_list_data = { + "funcModule": "数据表信息列表", + "funcOperation": "新增", + "data": [ + {"dataItemNo": "91230600716676129", + "dataDate": "20230113", + "dataStatus": "add", + "dataValue": 100.11 + }, + {"dataItemNo": "91230600716676129P|ETHYL_BEN|CAPACITY", + "dataDate": "20230113", + "dataStatus": "add", + "dataValue": 100.55 + }, + {"dataItemNo": "91230600716676129P|ETHYL_BEN|CAPACITY", + "dataDate": "20230113", + "dataStatus": "add", + "dataValue": 100.55 + } + ] +} + + + # 八大维度数据项编码 bdwd_items = { 'ciri': 'jxtppbdwdcr', diff --git a/main_juxiting.py b/main_juxiting.py index b63d2cd..ed9bbf1 100644 --- a/main_juxiting.py +++ b/main_juxiting.py @@ -33,6 +33,7 @@ global_config.update({ 'test_size': test_size, 'modelsindex': modelsindex, 'rote': rote, + 'bdwd_items': bdwd_items, # 特征工程开关 'is_del_corr': is_del_corr, @@ -44,13 +45,13 @@ global_config.update({ # 时间参数 'start_year': start_year, - 'end_time': end_time or datetime.datetime.now().strftime("%Y-%m-%d"), + 'end_time': end_time , 'freq': freq, # 保持列表结构 # 接口配置 'login_pushreport_url': login_pushreport_url, 'login_data': login_data, - 'upload_url': upload_url, + 'upload_url': upload_url, 'upload_warning_url': upload_warning_url, 'warning_data': warning_data, @@ -58,6 +59,10 @@ global_config.update({ 'query_data_list_item_nos_url': query_data_list_item_nos_url, 'query_data_list_item_nos_data': query_data_list_item_nos_data, + # 上传数据项 + 'push_data_value_list_url': push_data_value_list_url, + 'push_data_value_list_data': push_data_value_list_data, + # eta 配置 'APPID': APPID, 'SECRET': SECRET, @@ -354,7 +359,7 @@ def predict_main(): reportname=reportname, sqlitedb=sqlitedb), logger.info('制作报告end') - logger.info('模型训练完成') + logger.info('模型训练完成') push_market_value() @@ -383,12 +388,14 @@ def predict_main(): if __name__ == '__main__': # global end_time # 遍历2024-11-25 到 2024-12-3 之间的工作日日期 - for i_time in pd.date_range('2025-2-1', '2025-3-18', freq='M'): - try: - global_config['end_time'] = i_time.strftime('%Y-%m-%d') - predict_main() - except Exception as e: - logger.info(f'预测失败:{e}') - continue + # for i_time in pd.date_range('2025-2-1', '2025-3-18', freq='B'): + # try: + # global_config['end_time'] = i_time.strftime('%Y-%m-%d') + # predict_main() + # except Exception as e: + # logger.info(f'预测失败:{e}') + # continue # predict_main() + + push_market_value() diff --git a/models/nerulforcastmodels.py b/models/nerulforcastmodels.py index 72c9e25..8a1a325 100644 --- a/models/nerulforcastmodels.py +++ b/models/nerulforcastmodels.py @@ -371,8 +371,8 @@ def ex_Model_Juxiting(df, horizon, input_size, train_steps, val_check_steps, ear scaler_type='standard', early_stop_patience_steps=early_stop_patience_steps), TFT(h=horizon, input_size=input_size, max_steps=train_steps, val_check_steps=val_check_steps, scaler_type='standard', early_stop_patience_steps=early_stop_patience_steps), - FEDformer(h=horizon, input_size=input_size, max_steps=train_steps, val_check_steps=val_check_steps, - scaler_type='standard', early_stop_patience_steps=early_stop_patience_steps), + # FEDformer(h=horizon, input_size=input_size, max_steps=train_steps, val_check_steps=val_check_steps, + # scaler_type='standard', early_stop_patience_steps=early_stop_patience_steps), StemGNN(h=horizon, input_size=input_size, n_series=1, max_steps=train_steps, val_check_steps=val_check_steps, scaler_type='standard', early_stop_patience_steps=early_stop_patience_steps), MLPMultivariate(h=horizon, input_size=input_size, n_series=1, max_steps=train_steps, @@ -461,16 +461,20 @@ def ex_Model_Juxiting(df, horizon, input_size, train_steps, val_check_steps, ear if config.is_update_eta: df_predict['ds'] = pd.to_datetime(df_predict['ds']) dates = df_predict['ds'].dt.strftime('%Y-%m-%d') - + for m in modelsindex.keys(): - list = [] - for date, value in zip(dates, df_predict[m]): - list.append({'Date': date, 'Value': value}) - data['DataList'] = [list[-1]] - data['IndexCode'] = modelsindex[m] - data['IndexName'] = f'聚烯烃价格预测{m}模型' - data['Remark'] = m - etadata.push_data(data=data) + try: + list = [] + for date, value in zip(dates, df_predict[m].round(2)): + list.append({'Date': date, 'Value': value}) + data['DataList'] = [list[-1]] + data['IndexCode'] = modelsindex[m] + data['IndexName'] = f'聚烯烃价格预测{m}模型' + data['Remark'] = m + + etadata.push_data(data=data) + except Exception as e: + config.logger.error(f'上传eta数据失败:{e}') # return nf_test_preds return