原油八大维度调试
This commit is contained in:
parent
2525e0f5e1
commit
c1e1b27deb
@ -56,6 +56,7 @@ global_config = {
|
||||
'dataset': None, # 数据集路径
|
||||
'y': None, # 目标变量列名
|
||||
'is_fivemodels': None,
|
||||
'weight_dict': None,
|
||||
|
||||
# 模型参数
|
||||
'data_set': None, # 数据集名称
|
||||
@ -1106,6 +1107,8 @@ class Config:
|
||||
def y(self): return global_config['y']
|
||||
@property
|
||||
def is_fivemodels(self): return global_config['is_fivemodels']
|
||||
@property
|
||||
def weight_dict(self): return global_config['weight_dict']
|
||||
|
||||
# 模型参数
|
||||
@property
|
||||
|
@ -17,6 +17,7 @@ global_config.update({
|
||||
'is_train': is_train,
|
||||
'is_fivemodels': is_fivemodels,
|
||||
'settings': settings,
|
||||
'weight_dict': weight_dict,
|
||||
|
||||
|
||||
# 模型参数
|
||||
|
@ -1220,7 +1220,7 @@ def model_losss(sqlitedb, end_time):
|
||||
accuracy_rote = 0
|
||||
for i, group in df3.groupby('CREAT_DATE'):
|
||||
accuracy_rote += (group['ACCURACY'].sum() /
|
||||
len(group))*weight_dict[len(group)-1]
|
||||
len(group))*config.weight_dict[len(group)-1]
|
||||
accuracy_rote = round(accuracy_rote, 2)
|
||||
df4 = pd.DataFrame(columns=['开始日期', '结束日期', '准确率'])
|
||||
df4.loc[len(df4)] = {'开始日期': ds_dates[0],
|
||||
|
@ -9,14 +9,14 @@ import time
|
||||
def run_predictions(target_date):
|
||||
"""执行三个预测脚本"""
|
||||
scripts = [
|
||||
# "main_yuanyou.py",
|
||||
# "main_yuanyou_zhoudu.py",
|
||||
"main_yuanyou.py",
|
||||
"main_yuanyou_zhoudu.py",
|
||||
"main_yuanyou_yuedu.py"
|
||||
]
|
||||
|
||||
# 依次执行每个脚本
|
||||
for script in scripts:
|
||||
command = ["python", script]
|
||||
command = [r"C:\Users\Hello\.conda\envs\predict\python", script]
|
||||
subprocess.run(command, check=True)
|
||||
|
||||
|
||||
@ -29,19 +29,22 @@ if __name__ == "__main__":
|
||||
# start_date = datetime.date(2025, 3, 13)
|
||||
# 开始时间取当前时间
|
||||
start_date = datetime.date.today()
|
||||
end_date = datetime.date(2100, 12, 31)
|
||||
# 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(13, 15))
|
||||
while datetime.datetime.now() < target_time:
|
||||
time.sleep(60) # 每分钟检查一次
|
||||
print(f"等待到 {target_time} 开始执行任务")
|
||||
# while current_date <= end_date:
|
||||
# if is_weekday(current_date):
|
||||
# # 等待到目标日期的7点
|
||||
# target_time = datetime.datetime.combine(
|
||||
# current_date, datetime.time(13, 15))
|
||||
# while datetime.datetime.now() < target_time:
|
||||
# time.sleep(60) # 每分钟检查一次
|
||||
# print(f"等待到 {target_time} 开始执行任务")
|
||||
|
||||
print(f"开始执行 {current_date} 的预测任务")
|
||||
run_predictions(current_date)
|
||||
# print(f"开始执行 {current_date} 的预测任务")
|
||||
# run_predictions(current_date)
|
||||
|
||||
current_date += datetime.timedelta(days=1)
|
||||
# current_date += datetime.timedelta(days=1)
|
||||
|
||||
print(f"开始执行 {current_date} 的预测任务")
|
||||
run_predictions(current_date)
|
||||
|
Loading…
Reference in New Issue
Block a user