调试准确率

This commit is contained in:
workpc 2024-12-13 14:39:36 +08:00
parent 744594ac76
commit 1f827d8224
2 changed files with 36 additions and 36 deletions

View File

@ -178,25 +178,25 @@ def predict_main():
row, col = df.shape row, col = df.shape
now = datetime.datetime.now().strftime('%Y%m%d%H%M%S') now = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
ex_Model(df, # ex_Model(df,
horizon=horizon, # horizon=horizon,
input_size=input_size, # input_size=input_size,
train_steps=train_steps, # train_steps=train_steps,
val_check_steps=val_check_steps, # val_check_steps=val_check_steps,
early_stop_patience_steps=early_stop_patience_steps, # early_stop_patience_steps=early_stop_patience_steps,
is_debug=is_debug, # is_debug=is_debug,
dataset=dataset, # dataset=dataset,
is_train=is_train, # is_train=is_train,
is_fivemodels=is_fivemodels, # is_fivemodels=is_fivemodels,
val_size=val_size, # val_size=val_size,
test_size=test_size, # test_size=test_size,
settings=settings, # settings=settings,
now=now, # now=now,
etadata=etadata, # etadata=etadata,
modelsindex=modelsindex, # modelsindex=modelsindex,
data=data, # data=data,
is_eta=is_eta, # is_eta=is_eta,
) # )
logger.info('模型训练完成') logger.info('模型训练完成')

View File

@ -395,28 +395,28 @@ def model_losss(sqlitedb):
df_predict2 = df_combined3.tail(horizon) df_predict2 = df_combined3.tail(horizon)
# 保存到数据库 # 保存到数据库
# if not sqlitedb.check_table_exists('accuracy'): if not sqlitedb.check_table_exists('accuracy'):
# columns = ','.join(df_combined3.columns.to_list()+['id','CREAT_DATE']) columns = ','.join(df_combined3.columns.to_list()+['id','CREAT_DATE'])
# sqlitedb.create_table('accuracy',columns=columns) sqlitedb.create_table('accuracy',columns=columns)
# existing_data = sqlitedb.select_data(table_name = "accuracy") existing_data = sqlitedb.select_data(table_name = "accuracy")
# update_y = sqlitedb.select_data(table_name = "accuracy",where_condition='y is null') update_y = sqlitedb.select_data(table_name = "accuracy",where_condition='y is null')
# df_combined4 = df_combined3[(df_combined3['ds'].isin(update_y['ds'])) & (df_combined3['y'].notnull())] df_combined4 = df_combined3[(df_combined3['ds'].isin(update_y['ds'])) & (df_combined3['y'].notnull())]
# if len(df_combined4) > 0: if len(df_combined4) > 0:
# for index, row in df_combined4.iterrows(): for index, row in df_combined4.iterrows():
# sqlitedb.update_data('accuracy',f"y = {row['y']}",f"ds = '{row['ds']}'") sqlitedb.update_data('accuracy',f"y = {row['y']}",f"ds = '{row['ds']}'")
# print(df_combined4) print(df_combined4)
# if not existing_data.empty: if not existing_data.empty:
# max_id = existing_data['id'].astype(int).max() max_id = existing_data['id'].astype(int).max()
# df_predict2['id'] = range(max_id + 1, max_id + 1 + len(df_predict2)) df_predict2['id'] = range(max_id + 1, max_id + 1 + len(df_predict2))
# else: else:
# df_predict2['id'] = range(1, 1 + len(df_predict2)) df_predict2['id'] = range(1, 1 + len(df_predict2))
# df_predict2['CREAT_DATE'] = now if end_time == '' else end_time df_predict2['CREAT_DATE'] = now if end_time == '' else end_time
# df_predict2['PREDICT_DATE'] = df_predict2['ds'] # df_predict2['PREDICT_DATE'] = df_predict2['ds']
# df_predict2['MIN_PRICE'] = df_predict2['min_within_quantile'] # df_predict2['MIN_PRICE'] = df_predict2['min_within_quantile']
# df_predict2['MAX_PRICE'] = df_predict2['max_within_quantile'] # df_predict2['MAX_PRICE'] = df_predict2['max_within_quantile']
# df_predict2 = df_predict2[['id','PREDICT_DATE','CREAT_DATE','MIN_PRICE','MAX_PRICE']] # df_predict2 = df_predict2[['id','PREDICT_DATE','CREAT_DATE','MIN_PRICE','MAX_PRICE']]
# df_predict2.to_sql("accuracy", con=sqlitedb.connection, if_exists='append', index=False) df_predict2.to_sql("accuracy", con=sqlitedb.connection, if_exists='append', index=False)