添加模型执行脚本

This commit is contained in:
workpc 2025-03-13 10:33:47 +08:00
parent 6fa793e6b6
commit 9a81a3ae6c
4 changed files with 71 additions and 4 deletions

View File

@ -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 的情况下生效

22
models/TEST.py Normal file
View File

@ -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

View File

@ -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),

View File

@ -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)