Bayesian Optimized XGBoost Regression with SHAP Feature Interpretation Code
收藏DataCite Commons2026-05-03 更新2026-05-07 收录
下载链接:
https://zenodo.org/doi/10.5281/zenodo.20008638
下载链接
链接失效反馈官方服务:
资源简介:
This repository contains the complete Python code used for the Bayesian optimized XGBoost model and SHapley Additive exPlanations (SHAP) model in the manuscript Analysis of the Global and Local Effects of Urban Green Space Vegetation Types on Summer Near-Surface O₃ Concentrations Based on Street View Imagery—A Case Study of Hangzhou.
The main functionalities of the code include:
Data preprocessing and train/validation/test set splitting
Hyperparameter tuning of the XGBoost model via Bayesian optimization
Model performance evaluation using regression metrics (R², MSE, RMSE, MAE, MAPE, EVS)
SHAP feature importance analysis, including summary plots and feature contribution bar charts
Environment and Dependencies:
Operating System: Windows / macOS / Linux
Python version: 3.8 or higher
Required Python packages:
- numpy
- pandas
- matplotlib
- seaborn
- scikit-learn
- xgboost
- bayesian-optimization
- shap
- tabulate
Instructions to Run the Code:
Prepare the CSV-formatted dataset and ensure no missing values.
Update the data path in the code to your actual file path.
Place the data file in the same directory as the script.
Run the Python script directly.
All generated figures will be automatically saved in the output_plots folder after execution.
本仓库包含论文《基于街景影像的城市绿地植被类型对夏季近地面臭氧浓度的全局与局部影响分析——以杭州市为例》中所用的贝叶斯优化XGBoost模型与SHAP(SHapley Additive exPlanations)模型的完整Python代码。
该代码的主要功能包括:
1. 数据预处理与训练集、验证集、测试集划分
2. 通过贝叶斯优化完成XGBoost模型的超参数调优
3. 采用回归评估指标(决定系数R²、均方误差MSE、均方根误差RMSE、平均绝对误差MAE、平均绝对百分比误差MAPE、解释方差得分EVS)开展模型性能评价
4. SHAP特征重要性分析,涵盖特征汇总图与特征贡献柱状图
运行环境与依赖项:
- 操作系统:Windows / macOS / Linux
- Python版本:3.8及以上
- 所需Python第三方库:
- numpy
- pandas
- matplotlib
- seaborn
- scikit-learn
- xgboost
- bayesian-optimization
- shap
- tabulate
代码运行指南:
1. 准备CSV格式的数据集,并确保无缺失值
2. 将代码中的数据路径更新为实际文件路径
3. 将数据文件放置于与脚本相同的目录下
4. 直接运行该Python脚本
5. 脚本执行完成后,所有生成的图片将自动保存至output_plots文件夹中
提供机构:
Zenodo
创建时间:
2026-05-03



