xgb.dump 怎么多输出两棵树?# Programming - 葵花宝典
m*r
1 楼
再过来请教大家一次。
xgb.dump不知谁用过没有 ? 就是把xgb的模型输出成一堆决策树(forest). 用xgb.
train的时候,程序提示如下:
Stopping. Best iteration:
[170] train-auc:0.844678
[171] train-auc:0.844678
[172] train-auc:0.844678
[173] train-auc:0.844678
Stopping. Best iteration:
[73] train-auc:0.844718
让人不理解的是,xgb.dump 导出来的树(是个简单的文本文件, nodes, leafs, etc)
有75棵。 难道不应该是73棵么? 一棵树对应一个iteration.
文本文件的后半部分如下, 大家帮忙看看。
booster[73]
0:[f0<0.183333] yes=1,no=2,missing=1,gain=0.218959,cover=1687.94
1:leaf=0.0465228,cover=8.03316
2:[f0<2.70714] yes=3,no=4,missing=3,gain=0.193604,cover=1679.91
3:[f0<2.57778] yes=5,no=6,missing=5,gain=1.05379,cover=1651.7
5:leaf=-0.000163034,cover=1643.26
6:leaf=-0.100668,cover=8.44311
4:[f0<2.87857] yes=7,no=8,missing=7,gain=1.29737,cover=28.2044
7:leaf=0.141447,cover=5.55864
8:leaf=-0.00971044,cover=22.6457
booster[74]
0:[f0<0.133929] yes=1,no=2,missing=1,gain=0.216961,cover=1687.56
1:leaf=-0.0537049,cover=5.75036
2:[f0<2.68333] yes=3,no=4,missing=3,gain=0.143218,cover=1681.81
3:leaf=0.000572126,cover=1650.68
4:[f0<2.95] yes=7,no=8,missing=7,gain=1.15494,cover=31.1307
7:leaf=-0.0984178,cover=10.0429
8:leaf=0.0206187,cover=21.0878
booster[75]
0:[f0<0.183333] yes=1,no=2,missing=1,gain=0.20109,cover=1687.59
1:leaf=0.0448801,cover=7.91966
2:[f0<1.81667] yes=3,no=4,missing=3,gain=0.19341,cover=1679.67
3:[f0<1.78889] yes=5,no=6,missing=5,gain=1.83243,cover=1578.87
5:[f0<1.6125] yes=9,no=10,missing=9,gain=1.67969,cover=1563.04
9:leaf=-0.000927349,cover=1551.38
10:leaf=0.108819,cover=11.6538
6:leaf=-0.0995518,cover=15.8335
4:[f0<2.05] yes=7,no=8,missing=7,gain=1.00453,cover=100.801
7:leaf=0.0602009,cover=27.4933
8:[f0<2.21111] yes=13,no=14,missing=13,gain=1.4402,cover=73.3081
13:leaf=-0.0888714,cover=14.103
14:leaf=0.0147542,cover=59.2052
booster[76]
0:leaf=-2.9644e-005,cover=1685.27
booster[77]
0:leaf=-2.07543e-005,cover=1685.25
booster[78]
0:leaf=-1.45361e-005,cover=1685.24
booster[79]
0:leaf=-1.01768e-005,cover=1685.23
booster[80]
0:leaf=-7.14096e-006,cover=1685.22
booster[81]
0:leaf=-5.00394e-006,cover=1685.21
booster[82]
xgb.dump不知谁用过没有 ? 就是把xgb的模型输出成一堆决策树(forest). 用xgb.
train的时候,程序提示如下:
Stopping. Best iteration:
[170] train-auc:0.844678
[171] train-auc:0.844678
[172] train-auc:0.844678
[173] train-auc:0.844678
Stopping. Best iteration:
[73] train-auc:0.844718
让人不理解的是,xgb.dump 导出来的树(是个简单的文本文件, nodes, leafs, etc)
有75棵。 难道不应该是73棵么? 一棵树对应一个iteration.
文本文件的后半部分如下, 大家帮忙看看。
booster[73]
0:[f0<0.183333] yes=1,no=2,missing=1,gain=0.218959,cover=1687.94
1:leaf=0.0465228,cover=8.03316
2:[f0<2.70714] yes=3,no=4,missing=3,gain=0.193604,cover=1679.91
3:[f0<2.57778] yes=5,no=6,missing=5,gain=1.05379,cover=1651.7
5:leaf=-0.000163034,cover=1643.26
6:leaf=-0.100668,cover=8.44311
4:[f0<2.87857] yes=7,no=8,missing=7,gain=1.29737,cover=28.2044
7:leaf=0.141447,cover=5.55864
8:leaf=-0.00971044,cover=22.6457
booster[74]
0:[f0<0.133929] yes=1,no=2,missing=1,gain=0.216961,cover=1687.56
1:leaf=-0.0537049,cover=5.75036
2:[f0<2.68333] yes=3,no=4,missing=3,gain=0.143218,cover=1681.81
3:leaf=0.000572126,cover=1650.68
4:[f0<2.95] yes=7,no=8,missing=7,gain=1.15494,cover=31.1307
7:leaf=-0.0984178,cover=10.0429
8:leaf=0.0206187,cover=21.0878
booster[75]
0:[f0<0.183333] yes=1,no=2,missing=1,gain=0.20109,cover=1687.59
1:leaf=0.0448801,cover=7.91966
2:[f0<1.81667] yes=3,no=4,missing=3,gain=0.19341,cover=1679.67
3:[f0<1.78889] yes=5,no=6,missing=5,gain=1.83243,cover=1578.87
5:[f0<1.6125] yes=9,no=10,missing=9,gain=1.67969,cover=1563.04
9:leaf=-0.000927349,cover=1551.38
10:leaf=0.108819,cover=11.6538
6:leaf=-0.0995518,cover=15.8335
4:[f0<2.05] yes=7,no=8,missing=7,gain=1.00453,cover=100.801
7:leaf=0.0602009,cover=27.4933
8:[f0<2.21111] yes=13,no=14,missing=13,gain=1.4402,cover=73.3081
13:leaf=-0.0888714,cover=14.103
14:leaf=0.0147542,cover=59.2052
booster[76]
0:leaf=-2.9644e-005,cover=1685.27
booster[77]
0:leaf=-2.07543e-005,cover=1685.25
booster[78]
0:leaf=-1.45361e-005,cover=1685.24
booster[79]
0:leaf=-1.01768e-005,cover=1685.23
booster[80]
0:leaf=-7.14096e-006,cover=1685.22
booster[81]
0:leaf=-5.00394e-006,cover=1685.21
booster[82]