Merge branch 'main' of https://gitea.jayhgq.cn/liurui/PriceForecast
This commit is contained in:
		
						commit
						3b51565262
					
				
							
								
								
									
										11
									
								
								lib/tools.py
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								lib/tools.py
									
									
									
									
									
								
							| @ -780,6 +780,7 @@ def get_model_id_name_dict(global_config): | ||||
|     ''' | ||||
|     tb = 'v_tbl_predict_models' | ||||
|     sql = f'select model_name,id from {tb} ' | ||||
|     global_config['db_mysql'].connect() | ||||
|     modelsname = global_config['db_mysql'].execute_query(sql) | ||||
|     model_id_name_dict = {row['id']: row['model_name'] for row in modelsname} | ||||
|     global_config['logger'].info(f'模型id-name: {model_id_name_dict}') | ||||
| @ -1123,7 +1124,7 @@ def plot_pp_predict_result(y_hat, global_config,wd='yuedu'): | ||||
|     sns.lineplot(x=y['ds'], y=y['y'], color='blue', label='真实值', ax=ax) | ||||
| 
 | ||||
|     # date_str = pd.Timestamp(y_hat["ds"].iloc[0]).strftime('%Y-%m-%d') | ||||
|     ax.set_title(f'{global_config["end_time"]} PP期货八大维度 预测价格走势') | ||||
|     ax.set_title(f'{global_config["end_time"]} PP期货八大维度 预测价格走势', fontsize=24) | ||||
|     ax.set_xlabel('日期') | ||||
|     ax.set_ylabel('预测结果') | ||||
|     ax.tick_params(axis='x', rotation=45) | ||||
| @ -1147,6 +1148,10 @@ def plot_pp_predict_result(y_hat, global_config,wd='yuedu'): | ||||
|     # 在图表下方添加表格 | ||||
|     table = ax.table(cellText=data, colLabels=columns, | ||||
|                      loc='bottom', bbox=[0, -0.4, 1, 0.2],cellLoc='center') | ||||
|     # 设置表头为浅蓝色 | ||||
|     for (i, j), cell in table.get_celld().items(): | ||||
|         if i == 0:  # 表头行 | ||||
|             cell.set_facecolor('lightblue') | ||||
|     table.auto_set_font_size(False) | ||||
|     table.set_fontsize(12) | ||||
|      | ||||
| @ -1161,6 +1166,10 @@ def plot_pp_predict_result(y_hat, global_config,wd='yuedu'): | ||||
|         bbox=[0, -0.9, 1, 0.4],  # [左, 下, 宽, 高],调整下边界(-0.7)和高度(0.5)控制表格位置 | ||||
|         cellLoc='left' | ||||
|     ) | ||||
|     # 设置表头为浅蓝色 | ||||
|     for (i, j), cell in table.get_celld().items(): | ||||
|         if i == 0:  # 表头行 | ||||
|             cell.set_facecolor('lightblue') | ||||
|     table.auto_set_font_size(False)  # 关闭自动字体大小 | ||||
|     table.set_fontsize(10)           # 设置表格字体大小 | ||||
|     table.scale(1.1, 1.5)            # 调整表格缩放比例(宽度, 高度) | ||||
|  | ||||
| @ -477,7 +477,7 @@ def predict_main(): | ||||
|     #     sqlitedb, end_time=global_config['end_time'], is_fivemodels=global_config['is_fivemodels']) | ||||
|     # logger.info('训练数据绘图end') | ||||
| 
 | ||||
|     push_market_value() | ||||
|     # push_market_value() | ||||
| 
 | ||||
|     # sql_inset_predict(global_config) | ||||
| 
 | ||||
| @ -530,6 +530,7 @@ if __name__ == '__main__': | ||||
|     #         logger.info(f'预测失败:{e}') | ||||
|     #         continue | ||||
| 
 | ||||
|     global_config['end_time'] = '2025-08-01' | ||||
|     predict_main() | ||||
|     # push_market_value() | ||||
| 
 | ||||
|  | ||||
| @ -512,7 +512,11 @@ if __name__ == '__main__': | ||||
|     #         logger.info(f'预测失败:{e}') | ||||
|     #         continue | ||||
| 
 | ||||
| 
 | ||||
|     global_config['end_time'] = '2025-08-01' | ||||
|     global_config['db_mysql'].connect() | ||||
|     predict_main() | ||||
| 
 | ||||
| 
 | ||||
|     # push_market_value() | ||||
|     # sql_inset_predict(global_config) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user