原油周度预测,调试完成
This commit is contained in:
		
							parent
							
								
									459cf1763c
								
							
						
					
					
						commit
						dab9fadc77
					
				| @ -160,7 +160,7 @@ table_name = 'v_tbl_crude_oil_warning' | ||||
| 
 | ||||
| ### 开关 | ||||
| is_train = False # 是否训练 | ||||
| is_debug = True # 是否调试 | ||||
| is_debug = False # 是否调试 | ||||
| is_eta = False # 是否使用eta接口 | ||||
| is_market = True # 是否通过市场信息平台获取特征 ,在is_eta 为true 的情况下生效 | ||||
| is_timefurture = True # 是否使用时间特征 | ||||
| @ -182,7 +182,7 @@ print("数据库连接成功",host,dbname,dbusername) | ||||
| 
 | ||||
| 
 | ||||
| # 数据截取日期 | ||||
| start_year = 2017 # 数据开始年份 | ||||
| start_year = 2020 # 数据开始年份 | ||||
| end_time = '' # 数据截取日期 | ||||
| freq = 'W'  # 时间频率,"D": 天 "W": 周"M": 月"Q": 季度"A": 年 "H": 小时 "T": 分钟 "S": 秒 "B": 工作日 | ||||
| delweekenday = True if freq == 'B' else False # 是否删除周末数据 | ||||
|  | ||||
| @ -288,11 +288,10 @@ def predict_main(): | ||||
| 
 | ||||
| 
 | ||||
| if __name__ == '__main__': | ||||
|     # global end_time | ||||
|     # is_on = True | ||||
|     # # 遍历2024-11-25 到 2024-12-3 之间的工作日日期 | ||||
|     # for i_time in pd.date_range('2024-10-8', '2025-2-12', freq='W'): | ||||
|     #     end_time = i_time.strftime('%Y-%m-%d') | ||||
|     #     predict_main() | ||||
|     global end_time | ||||
|     # 遍历2024-11-25 到 2024-12-3 之间的工作日日期 | ||||
|     for i_time in pd.date_range('2024-10-8', '2025-2-26', freq='W'): | ||||
|         end_time = i_time.strftime('%Y-%m-%d') | ||||
|         predict_main() | ||||
| 
 | ||||
|     predict_main() | ||||
|     # predict_main() | ||||
| @ -860,7 +860,7 @@ def model_losss(sqlitedb,end_time): | ||||
|     # 然后筛选出那些 cutoff 等于 max_cutoff 的行,这样就得到了每个分组中 cutoff 最大的行,并保留了其他列 | ||||
|     df_combined = df_combined[df_combined['CREAT_DATE'] == df_combined['max_cutoff']] | ||||
|     # 删除模型生成的cutoff列 | ||||
|     df_combined.drop(columns=['CREAT_DATE', 'max_cutoff','created_dt','min_within_quantile','max_within_quantile','id','min_price','max_price','LOW_PRICE','HIGH_PRICE'], inplace=True,errors='ignore')  | ||||
|     df_combined.drop(columns=['CREAT_DATE', 'max_cutoff','created_dt','min_within_quantile','max_within_quantile','id','min_price','max_price','LOW_PRICE','HIGH_PRICE','mean'], inplace=True,errors='ignore')  | ||||
|     # 获取模型名称 | ||||
|     modelnames  = df_combined.columns.to_list()[1:]  | ||||
|     if 'y' in modelnames: | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user