【MATLAB第70期】基于MATLAB的LightGbm(LGBM)梯度增强决策树多输入单输出回归预测及多分类预测模型(全网首发)
一、学习资料
(LGBM)是一种基于梯度增强决策树(GBDT)算法。
本次研究三个内容,分别是回归预测,二分类预测和多分类预测
参考链接:
lightgbm原理参考链接:
训练过程评价指标metric函数参考链接:
lightgbm参数介绍参考链接:
lightgbm调参参考链接:
二、回归预测(多输入单输出)
1.数据设置
数据(103个样本,7输入1输出)
2.预测结果
3.参数设置
parameters=containers.Map;
parameters('task')='train';
parameters('boosting_type')='gbdt';
parameters('metric')='rmse';
parameters('num_leaves')=31;
parameters('learning_rate')=0.05; %越大,训练集效果越好
parameters('feature_fraction')=0.9;
parameters('bagging_fraction')=0.8;
parameters('bagging_freq')=5;
parameters('num_threads')=1;
parameters('verbose')=1;
4.训练过程
[ 1] train rmse 0.208872
[ 2] train rmse 0.203687
[ 3] train rmse 0.202175
[ 4] train rmse 0.200801
[ 5] train rmse 0.199554
[ 6] train rmse 0.196124
[ 7] train rmse 0.193003
[ 8] train rmse 0.192100
[ 9] train rmse 0.189259
[ 10] train rmse 0.186576
............
[ 490] train rmse 0.052932
[ 491] train rmse 0.052870
[ 492] train rmse 0.052847
[ 493] train rmse 0.052830
[ 494] train rmse 0.052820
[ 495] train rmse 0.052771
[ 496] train rmse 0.052689
[ 497] train rmse 0.052619
[ 498] train rmse 0.052562
[ 499] train rmse 0.052506
[ 500] train rmse 0.052457
bestIteration: 500
训练集数据的R2为:0.94018
测试集数据的R2为:0.87118
训练集数据的MAE为:1.365
测试集数据的MAE为:2.3607
训练集数据的MBE为:-0.079848
测试集数据的MBE为:-1.0132
5.特征变量敏感性分析
三、分类预测(多输入单输出二分类)
1.数据设置
数据(357个样本,12输入1输出)
2.预测结果
3.参数设置
parameters=containers.Map;
parameters('task')='train';
parameters('boosting_type')='gbdt';
parameters('metric')='binary_error';
parameters('num_leaves')=31;
parameters('learning_rate')=0.05;
parameters('feature_fraction')=0.9;
parameters('bagging_fraction')=0.8;
parameters('bagging_freq')=5;
parameters('num_threads')=1;
parameters('verbose')=0;
4.训练过程
[ 0] train binary_error 0.020833
[ 1] train binary_error 0.020833
[ 2] train binary_error 0.020833
[ 3] train binary_error 0.020833
[ 4] train binary_error 0.020833
[ 5] train binary_error 0.020833
[ 6] train binary_error 0.020833
............
[ 191] train binary_error 0.000000
[ 192] train binary_error 0.000000
[ 193] train binary_error 0.000000
[ 194] train binary_error 0.000000
[ 195] train binary_error 0.000000
[ 196] train binary_error 0.000000
[ 197] train binary_error 0.000000
[ 198] train binary_error 0.000000
[ 199] train binary_error 0.000000
bestIteration: 200
5.特征变量敏感性分析
四、分类预测(多输入单输出多分类)
1.数据设置
数据(357个样本,12输入1输出。4分类)
2.预测结果
3.参数设置
parameters=containers.Map;
parameters('task')='train';
parameters('boosting_type')='gbdt';
parameters('metric')='multi_error';
parameters('num_leaves')=31;
parameters('learning_rate')=0.05;
parameters('feature_fraction')=0.9;
parameters('bagging_fraction')=0.8;
parameters('bagging_freq')=5;
parameters('num_threads')=1;
parameters('verbose')=0;
4.训练过程
[ 0] train multi_error 0.112500
[ 1] train multi_error 0.066667
[ 2] train multi_error 0.066667
[ 3] train multi_error 0.066667
[ 4] train multi_error 0.062500
[ 5] train multi_error 0.058333
[ 6] train multi_error 0.054167
[ 7] train multi_error 0.054167
[ 8] train multi_error 0.058333
[ 9] train multi_error 0.058333
[ 10] train multi_error 0.054167
[ 11] train multi_error 0.054167
............
[ 190] train multi_error 0.000000
[ 191] train multi_error 0.000000
[ 192] train multi_error 0.000000
[ 193] train multi_error 0.000000
[ 194] train multi_error 0.000000
[ 195] train multi_error 0.000000
[ 196] train multi_error 0.000000
[ 197] train multi_error 0.000000
[ 198] train multi_error 0.000000
[ 199] train multi_error 0.000000
bestIteration: 200
5.特征变量敏感性分析
文章来源:https://www.toymoban.com/news/detail-685081.html
五、代码获取
CSDN后台私信回复“70期”即可获取下载方式。文章来源地址https://www.toymoban.com/news/detail-685081.html
到了这里,关于【MATLAB第70期】基于MATLAB的LightGbm(LGBM)梯度增强决策树多输入单输出回归预测及分类预测模型(全网首发)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!