AutoML之flaml:基于flaml框架对比lightgbm和xgboost模型进行自动化参数调优实现体内脂肪含量值回归预测案例之详细攻略
Posted 一个处女座的程序猿
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AutoML之flaml:基于flaml框架对比lightgbm和xgboost模型进行自动化参数调优实现体内脂肪含量值回归预测案例之详细攻略相关的知识,希望对你有一定的参考价值。
AutoML之flaml:基于flaml框架对比lightgbm和xgboost模型进行自动化参数调优实现体内脂肪含量值回归预测案例之详细攻略
目录
基于flaml框架对比lightgbm和xgboost模型进行自动化参数调优实现体内脂肪含量值回归预测案例
相关文章
AutoML之flaml:基于flaml框架对比lightgbm和xgboost模型进行自动化参数调优实现体内脂肪含量值回归预测案例之详细攻略
AutoML之flaml:基于flaml框架对比lightgbm和xgboost模型进行自动化参数调优实现体内脂肪含量值回归预测案例实现代码
基于flaml框架对比lightgbm和xgboost模型进行自动化参数调优实现体内脂肪含量值回归预测案例
# 1、定义数据集
Density | Age | Weight | Height | Neck | Chest | Abdomen | Hip | Thigh | Knee | Ankle | Biceps | Forearm | Wrist | class | |
26 | 1.0811 | 34 | 131.5 | 67.5 | 36.2 | 88.6 | 74.6 | 85.3 | 51.7 | 34.7 | 21.4 | 28.7 | 27 | 16.5 | 7.9 |
11 | 1.0812 | 27 | 216 | 76 | 39.4 | 103.6 | 90.9 | 107.7 | 66.2 | 39.2 | 25.9 | 37.2 | 30.2 | 19 | 7.8 |
62 | 1.0298 | 54 | 193.25 | 70.25 | 38 | 107.6 | 102.4 | 99.4 | 61 | 39.4 | 23.6 | 32.7 | 29.9 | 19.1 | 30.7 |
54 | 1.0906 | 42 | 136.25 | 67.5 | 37.8 | 87.6 | 77.6 | 88.6 | 51.9 | 34.9 | 22.5 | 27.7 | 27.5 | 18.5 | 3.9 |
72 | 1.0796 | 56 | 160.75 | 73.75 | 36.4 | 93.6 | 82.9 | 96.3 | 52.9 | 37.5 | 23.1 | 29.7 | 27.3 | 18.2 | 8.5 |
234 | 1.0403 | 60 | 157.75 | 67.5 | 40.4 | 97.2 | 93.3 | 94 | 54.3 | 35.7 | 21 | 31.3 | 28.7 | 18.3 | 25.8 |
127 | 1.059 | 43 | 152.25 | 67.75 | 37.5 | 95.9 | 78 | 93.2 | 53.5 | 35.8 | 20.8 | 33.9 | 28.2 | 17.4 | 17.4 |
241 | 1.0207 | 65 | 224.5 | 68.25 | 38.8 | 119.6 | 118 | 114.3 | 61.3 | 42.1 | 23.4 | 34.9 | 30.1 | 19.4 | 35 |
212 | 1.0543 | 49 | 168.25 | 71.75 | 38.3 | 98.3 | 89.7 | 99.1 | 56.3 | 38.8 | 23 | 29.5 | 27.9 | 18.6 | 19.5 |
137 | 1.0325 | 43 | 187.75 | 74 | 37.7 | 97.8 | 98.6 | 100.6 | 63.6 | 39.2 | 23.8 | 34.3 | 28.4 | 17.7 | 29.4 |
169 | 1.061 | 35 | 172.75 | 69.5 | 37.6 | 99.1 | 90.8 | 98.1 | 60.1 | 39.1 | 23.4 | 32.5 | 29.8 | 17.4 | 16.5 |
219 | 1.0646 | 53 | 154.5 | 69.25 | 37.6 | 93.9 | 88.7 | 94.5 | 53.7 | 36.2 | 22 | 28.5 | 25.7 | 17.1 | 15 |
50 | 1.0756 | 47 | 158.25 | 72.25 | 34.9 | 90.2 | 86.7 | 98.3 | 52.6 | 37.2 | 22.4 | 26 | 25.8 | 17.3 | 10.2 |
248 | 1.0236 | 72 | 201 | 69.75 | 40.9 | 108.5 | 105 | 104.5 | 59.6 | 40.8 | 23.2 | 35.2 | 28.6 | 20.1 | 33.6 |
245 | 1.0641 | 68 | 155.5 | 69.25 | 36.3 | 97.4 | 84.3 | 94.4 | 54.3 | 37.5 | 22.6 | 29.2 | 27.3 | 18.5 | 15.2 |
184 | 1.0587 | 40 | 170.5 | 74.25 | 37.7 | 98.9 | 90.4 | 95.5 | 55.4 | 38.9 | 22.4 | 30.5 | 28.9 | 17.7 | 17.5 |
148 | 1.0873 | 25 | 143.75 | 72.5 | 35.2 | 92.3 | 76.5 | 92.1 | 51.9 | 35.7 | 22 | 25.8 | 25.2 | 16.9 | 5.3 |
226 | 1.065 | 55 | 169.5 | 68.25 | 37.2 | 101.7 | 91.1 | 97.1 | 56.6 | 38.5 | 22.6 | 33.4 | 29.3 | 18.8 | 14.8 |
95 | 1.0991 | 53 | 224.5 | 77.75 | 41.1 | 113.2 | 99.2 | 107.5 | 61.7 | 42.3 | 23.2 | 32.9 | 30.8 | 20.4 | 17.4 |
41 | 1.025 | 44 | 205 | 29.5 | 36.6 | 106 | 104.3 | 115.5 | 70.6 | 42.5 | 23.7 | 33.6 | 28.7 | 17.4 | 32.9 |
# 3、模型训练与验证
# 3.1、切分数据集
# 3.2、模型建立及训练
# 设定参数
# 3.3、输出最佳参数及其loss、耗费时间
xgboost
Best hyperparmeter config: 'n_estimators': 62, 'max_leaves': 10, 'min_child_weight': 0.7892720199977752, 'learning_rate': 0.1101743533128382, 'subsample': 0.746247577681268, 'colsample_bylevel': 0.7152322660529653, 'colsample_bytree': 0.9299683267604371, 'reg_alpha': 0.0391736214683682, 'reg_lambda': 0.0043196018324903095
Best r2 on validation data: 0.9624
Training duration of best run: 0.03208 s
lgbm
Best hyperparmeter config: 'n_estimators': 43, 'num_leaves': 4, 'min_child_samples': 4, 'learning_rate': 0.6033971750435617, 'log_max_bin': 7, 'colsample_bytree': 0.9043858352550422, 'reg_alpha': 0.0009765625, 'reg_lambda': 32.27210014686686
Best r2 on validation data: 0.9586
Training duration of best run: 0.008558 s
# 3.4、模型评估
R2: 0.9853399901027871
MAE: 0.6854529804653592
MSE: 0.9898463799269194
R2: 0.9727251680203316
MAE: 1.0213410357069146
MSE: 1.8416013282039074
# 3.5、输出模型特征重要性(针对xgboost算法)
以上是关于AutoML之flaml:基于flaml框架对比lightgbm和xgboost模型进行自动化参数调优实现体内脂肪含量值回归预测案例之详细攻略的主要内容,如果未能解决你的问题,请参考以下文章
微软 AutoML 框架之 FLAML | 环境配置安装分类/回归测试