#自动构建树模型
##自动构建xgboost或lightgbm模型
### 一、训练、自动选变量、自动调参数
1、训练模型
2、shap 或 feature importance自动筛选变量
3、相关性筛选变量
4、PSI筛选变量
5、自动调参
6、逐步剔除变量
7、构建最终模型
### 二、建模相关结果保存
1、将模型文件持久化
2、将变量重要性持久化
3、将模型效果持久化
4、500条x数据用于验证后续部署是否一致
5、模型在建模数据集上的预测结果持久化
## 三、使用教程
请查看ryan_tutorial_code.py。里面有两个例子,一个列子使用的数据集随机生成的数据,一个是虚构现实数据
## 四、依赖包安装(建议先创建虚拟环境,不创建虚拟环境也行,创建虚拟环境是为了不和其它项目有依赖包的冲突,不创建虚拟环境的话在基础python环境执行pip install即可)
####创建虚拟环境
conda create -y --force -n auto_build_tree_model python=3.7.2
####激活虚拟环境
conda activate auto_build_tree_model
### 依赖包安装方式一
####安装依赖包
pip install pandas==1.2.4
pip install joblib==0.14.1
pip install xgboost==1.2.0
pip install bayesian-optimization==1.1.0
pip install lightgbm==3.2.1
pip install shap==0.36.0
### 依赖包安装方式二,执行如下命令安装依赖的包
pip install -r requirements.txt
=======
History
=======
0.1.5 (2023-11-14)
------------------
* First release on PyPI.
Raw data
{
"_id": null,
"home_page": "https://github.com/ZhengRyan/autotreemodel",
"name": "autotreemodel",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "autotreemodel",
"author": "RyanZheng",
"author_email": "zhengruiping000@163.com",
"download_url": "https://files.pythonhosted.org/packages/d7/10/6404ed34d4e39adb75a370857bf8d8981cafc8ebe535e4df3ba3ca460631/autotreemodel-0.1.6.tar.gz",
"platform": null,
"description": "#\u81ea\u52a8\u6784\u5efa\u6811\u6a21\u578b\n##\u81ea\u52a8\u6784\u5efaxgboost\u6216lightgbm\u6a21\u578b\n\n### \u4e00\u3001\u8bad\u7ec3\u3001\u81ea\u52a8\u9009\u53d8\u91cf\u3001\u81ea\u52a8\u8c03\u53c2\u6570\n1\u3001\u8bad\u7ec3\u6a21\u578b\n\n2\u3001shap \u6216 feature importance\u81ea\u52a8\u7b5b\u9009\u53d8\u91cf\n\n3\u3001\u76f8\u5173\u6027\u7b5b\u9009\u53d8\u91cf\n\n4\u3001PSI\u7b5b\u9009\u53d8\u91cf\n\n5\u3001\u81ea\u52a8\u8c03\u53c2\n\n6\u3001\u9010\u6b65\u5254\u9664\u53d8\u91cf\n\n7\u3001\u6784\u5efa\u6700\u7ec8\u6a21\u578b\n\n### \u4e8c\u3001\u5efa\u6a21\u76f8\u5173\u7ed3\u679c\u4fdd\u5b58\n1\u3001\u5c06\u6a21\u578b\u6587\u4ef6\u6301\u4e45\u5316\n\n2\u3001\u5c06\u53d8\u91cf\u91cd\u8981\u6027\u6301\u4e45\u5316\n\n3\u3001\u5c06\u6a21\u578b\u6548\u679c\u6301\u4e45\u5316\n\n4\u3001500\u6761x\u6570\u636e\u7528\u4e8e\u9a8c\u8bc1\u540e\u7eed\u90e8\u7f72\u662f\u5426\u4e00\u81f4\n\n5\u3001\u6a21\u578b\u5728\u5efa\u6a21\u6570\u636e\u96c6\u4e0a\u7684\u9884\u6d4b\u7ed3\u679c\u6301\u4e45\u5316\n\n## \u4e09\u3001\u4f7f\u7528\u6559\u7a0b\n\u8bf7\u67e5\u770bryan_tutorial_code.py\u3002\u91cc\u9762\u6709\u4e24\u4e2a\u4f8b\u5b50\uff0c\u4e00\u4e2a\u5217\u5b50\u4f7f\u7528\u7684\u6570\u636e\u96c6\u968f\u673a\u751f\u6210\u7684\u6570\u636e\uff0c\u4e00\u4e2a\u662f\u865a\u6784\u73b0\u5b9e\u6570\u636e\n\n\n## \u56db\u3001\u4f9d\u8d56\u5305\u5b89\u88c5\uff08\u5efa\u8bae\u5148\u521b\u5efa\u865a\u62df\u73af\u5883\uff0c\u4e0d\u521b\u5efa\u865a\u62df\u73af\u5883\u4e5f\u884c\uff0c\u521b\u5efa\u865a\u62df\u73af\u5883\u662f\u4e3a\u4e86\u4e0d\u548c\u5176\u5b83\u9879\u76ee\u6709\u4f9d\u8d56\u5305\u7684\u51b2\u7a81\uff0c\u4e0d\u521b\u5efa\u865a\u62df\u73af\u5883\u7684\u8bdd\u5728\u57fa\u7840python\u73af\u5883\u6267\u884cpip install\u5373\u53ef\uff09\n####\u521b\u5efa\u865a\u62df\u73af\u5883\nconda create -y --force -n auto_build_tree_model python=3.7.2\n####\u6fc0\u6d3b\u865a\u62df\u73af\u5883\nconda activate auto_build_tree_model\n\n### \u4f9d\u8d56\u5305\u5b89\u88c5\u65b9\u5f0f\u4e00\n\n####\u5b89\u88c5\u4f9d\u8d56\u5305\npip install pandas==1.2.4\n\npip install joblib==0.14.1\n\npip install xgboost==1.2.0\n\npip install bayesian-optimization==1.1.0\n\npip install lightgbm==3.2.1\n\npip install shap==0.36.0\n\n### \u4f9d\u8d56\u5305\u5b89\u88c5\u65b9\u5f0f\u4e8c\uff0c\u6267\u884c\u5982\u4e0b\u547d\u4ee4\u5b89\u88c5\u4f9d\u8d56\u7684\u5305\npip install -r requirements.txt\n\n\n=======\nHistory\n=======\n\n0.1.5 (2023-11-14)\n------------------\n\n* First release on PyPI.\n\n\n",
"bugtrack_url": null,
"license": "MIT license",
"summary": "auto build a tree model",
"version": "0.1.6",
"project_urls": {
"Homepage": "https://github.com/ZhengRyan/autotreemodel"
},
"split_keywords": [
"autotreemodel"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3a18f0a2bc1771129830f8832f792a6a023a382b4067d2a199f233c82a3d55ef",
"md5": "a316835ada447dd9e6296e9326857185",
"sha256": "9af319809c3ab8b3870f936ccb532ecc80d8310eea1fe49aaafd34b660f718fa"
},
"downloads": -1,
"filename": "autotreemodel-0.1.6-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "a316835ada447dd9e6296e9326857185",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6",
"size": 21158,
"upload_time": "2023-11-14T11:19:55",
"upload_time_iso_8601": "2023-11-14T11:19:55.547715Z",
"url": "https://files.pythonhosted.org/packages/3a/18/f0a2bc1771129830f8832f792a6a023a382b4067d2a199f233c82a3d55ef/autotreemodel-0.1.6-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d7106404ed34d4e39adb75a370857bf8d8981cafc8ebe535e4df3ba3ca460631",
"md5": "6b4160dbf5b4e2cca031c39a5c600eff",
"sha256": "6f75703c167d43ad2cdc11d7ae8704d1797509847bcfeeecd9034b70729c5119"
},
"downloads": -1,
"filename": "autotreemodel-0.1.6.tar.gz",
"has_sig": false,
"md5_digest": "6b4160dbf5b4e2cca031c39a5c600eff",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 3921903,
"upload_time": "2023-11-14T11:19:59",
"upload_time_iso_8601": "2023-11-14T11:19:59.227803Z",
"url": "https://files.pythonhosted.org/packages/d7/10/6404ed34d4e39adb75a370857bf8d8981cafc8ebe535e4df3ba3ca460631/autotreemodel-0.1.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-14 11:19:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ZhengRyan",
"github_project": "autotreemodel",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "bayesian-optimization",
"specs": [
[
"==",
"1.1.0"
]
]
},
{
"name": "joblib",
"specs": [
[
">=",
"0.12"
]
]
},
{
"name": "lightgbm",
"specs": [
[
"==",
"3.2.1"
]
]
},
{
"name": "pandas",
"specs": []
},
{
"name": "shap",
"specs": [
[
"==",
"0.36.0"
]
]
},
{
"name": "xgboost",
"specs": [
[
"==",
"1.2.0"
]
]
},
{
"name": "scikit-learn",
"specs": [
[
"==",
"0.21"
]
]
},
{
"name": "matplotlib",
"specs": [
[
"==",
"3.1.2"
]
]
}
],
"lcname": "autotreemodel"
}