xgboost 中的树形模型输出 dump model

Dump model

Dump model 是一个基础特性,目前为止只有树形模型支持文本输出。
它可以把决策树用文本的方式输出出来。
下面看一个例子:

booster[0]:
0:[odor=pungent] yes=2,no=1
    1:[stalk-root=cup] yes=4,no=3
        3:leaf=1.71218
        4:leaf=-1.70044
    2:[spore-print-color=orange] yes=6,no=5
        5:leaf=-1.94071
        6:leaf=1.85965
booster[1]:
0:[stalk-root=missing] yes=2,no=1
    1:[odor=pungent] yes=4,no=3
        3:leaf=0.784718
        4:leaf=-0.96853
    2:leaf=-6.23624

当然,它需要一个特征与文件的对照表,就是一个 feature map 文件

Feature map 文件

Feature map 文件格式如下:

Format of featmap.txt: <featureid> <featurename> <q or i or int>\n:

    Feature id must be from 0 to number of features, in sorted order.
    i means this feature is binary indicator feature
    q means this feature is a quantitative value, such as age, time, can be missing
    int means this feature is integer value (when int is hinted, the decision boundary will be integer)

0   cap-shape=bell  i
1   cap-shape=conical   i
2   cap-shape=convex    i
3   cap-shape=flat  i
.
.
.
通过实例我们可以看出,feature map 的格式:
    <特征 id> <特征名称=特征值> <q or i or int>
    - 特征 id 排序从 0 开始升序
    - i 二选一的特征
    - q 数量值,如年龄、时间。这个值可以是空
    - int 整型特征,它的决策边界也应该是整型
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 13
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值