From 9a81a3ae6c9bd1d572184eeef740263f7b05f73a Mon Sep 17 00:00:00 2001 From: workpc Date: Thu, 13 Mar 2025 10:33:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A8=A1=E5=9E=8B=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config_jingbo.py | 6 ++--- models/TEST.py | 22 ++++++++++++++++++ models/nerulforcastmodels.py | 2 +- 原油八大维度预测任务.py | 45 ++++++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 4 deletions(-) create mode 100644 models/TEST.py create mode 100644 原油八大维度预测任务.py diff --git a/config_jingbo.py b/config_jingbo.py index 49e3ffb..74ede77 100644 --- a/config_jingbo.py +++ b/config_jingbo.py @@ -90,8 +90,8 @@ ClassifyId = 1214 # 变量定义--测试环境 -# server_host = '192.168.100.53' # 内网 -server_host = '183.242.74.28 ' # 外网 +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" @@ -197,7 +197,7 @@ table_name = 'v_tbl_crude_oil_warning' # 开关 -is_train = False # 是否训练 +is_train = True # 是否训练 is_debug = True # 是否调试 is_eta = True # 是否使用eta接口 is_market = True # 是否通过市场信息平台获取特征 ,在is_eta 为true 的情况下生效 diff --git a/models/TEST.py b/models/TEST.py new file mode 100644 index 0000000..8b54df8 --- /dev/null +++ b/models/TEST.py @@ -0,0 +1,22 @@ +NHITS +Informer +LSTM +iTransformer +TSMixer +TSMixerx +PatchTST +RNN +GRU +TCN +BiTCN +DilatedRNN +MLP +DLinear +NLinear +TFT +FEDformer +StemGNN +MLPMultivariate +TiDE +DeepNPTS +NBEATS diff --git a/models/nerulforcastmodels.py b/models/nerulforcastmodels.py index 2cd550c..8962737 100644 --- a/models/nerulforcastmodels.py +++ b/models/nerulforcastmodels.py @@ -165,7 +165,7 @@ def ex_Model(df, horizon, input_size, train_steps, val_check_steps, early_stop_p # 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', ), //报错了 - # 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', ), //报错 # HINT(h=horizon), diff --git a/原油八大维度预测任务.py b/原油八大维度预测任务.py new file mode 100644 index 0000000..f109f6c --- /dev/null +++ b/原油八大维度预测任务.py @@ -0,0 +1,45 @@ +# 这是原油日度,周度,月度的预测,脚本 +# 遍历时间,跳过周六日,每日7点开始预测 + +import datetime +import subprocess +import time + + +def run_predictions(target_date): + """执行三个预测脚本""" + scripts = [ + "main_yuanyou.py", + "main_yuanyou_zhoudu.py", + "main_yuanyou_yuedu.py" + ] + + # 合并命令为单个进程执行 + command = ["python"] + command.extend(scripts) + subprocess.run(command, check=True) + + +def is_weekday(date): + """判断是否为工作日(周一到周五)""" + return date.weekday() < 5 # 0-4 为周一到周五 + + +if __name__ == "__main__": + start_date = datetime.date(2025, 3, 13) + end_date = datetime.date(2100, 12, 31) + + current_date = start_date + while current_date <= end_date: + if is_weekday(current_date): + # 等待到目标日期的7点 + target_time = datetime.datetime.combine( + current_date, datetime.time(9, 40)) + while datetime.datetime.now() < target_time: + time.sleep(60) # 每分钟检查一次 + print(f"等待到 {target_time} 开始执行任务") + + print(f"开始执行 {current_date} 的预测任务") + run_predictions(current_date) + + current_date += datetime.timedelta(days=1)