From 1ad1553e010b1e2f2ffb3f9aac4e645336adcb06 Mon Sep 17 00:00:00 2001 From: liurui Date: Mon, 16 Dec 2024 11:21:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=87=86=E7=A1=AE=E7=8E=87?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main_yuanyou.py | 4 ++-- models/nerulforcastmodels.py | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/main_yuanyou.py b/main_yuanyou.py index 87a8c4b..8e3788a 100644 --- a/main_yuanyou.py +++ b/main_yuanyou.py @@ -234,12 +234,12 @@ def predict_main(end_time): file=max(glob.glob(os.path.join(dataset,'*.pdf')), key=os.path.getctime), ssl=ssl, ) - # m.send_mail() + m.send_mail() if __name__ == '__main__': # 遍历2024-11-25 到 2024-12-3 之间的工作日日期 - for i_time in pd.date_range('2024-12-16', '2024-12-17', freq='B'): + for i_time in pd.date_range('2024-11-22', '2024-12-16', freq='B'): end_time = i_time.strftime('%Y-%m-%d') # print(e_time) predict_main(end_time) \ No newline at end of file diff --git a/models/nerulforcastmodels.py b/models/nerulforcastmodels.py index 103d121..64d2e8c 100644 --- a/models/nerulforcastmodels.py +++ b/models/nerulforcastmodels.py @@ -187,9 +187,9 @@ def ex_Model(df,horizon,input_size,train_steps,val_check_steps,early_stop_patien logger.info('读取模型:'+ filename) nf = load(filename) # # # 测试集预测 - # nf_test_preds = nf.cross_validation(df=df_test, val_size=val_size, test_size=test_size, n_windows=None) + nf_test_preds = nf.cross_validation(df=df_test, val_size=val_size, test_size=test_size, n_windows=None) # # 测试集预测结果保存 - # nf_test_preds.to_csv(os.path.join(dataset,"cross_validation.csv"),index=False) + nf_test_preds.to_csv(os.path.join(dataset,"cross_validation.csv"),index=False) df_test['ds'] = pd.to_datetime(df_test['ds'], errors='coerce') @@ -426,7 +426,12 @@ def model_losss(sqlitedb,end_time): # 上周准确率计算 predict_y = sqlitedb.select_data(table_name = "accuracy") ids = predict_y[predict_y['min_price'].isnull()]['id'].tolist() - predict_y[['min_price','max_price']] = predict_y[['min_within_quantile','max_within_quantile']] + # 模型评估前五最大最小 + # predict_y[['min_price','max_price']] = predict_y[['min_within_quantile','max_within_quantile']] + # 模型评估前五均值 df_combined3['mean'] = df_combined3[modelnames].mean(axis=1) + + predict_y['min_price'] = predict_y[modelnames].mean(axis=1) -1 + predict_y['max_price'] = predict_y[modelnames].mean(axis=1) +1 for id in ids: row = predict_y[predict_y['id'] == id] try: