【发布时间】:2017-06-30 10:00:59
【问题描述】:
param = {'max_depth': 2, 'eta': 1, 'silent': 0, 'objective':
'multi:softmax', 'num_class': 10}
num_round = 1
res = xgb.cv(param, dtrain, num_round, nfold=10,
metrics={'merror'}, seed=0, verbose_eval=True,
callbacks=[xgb.callback.print_evaluation(show_stdv=True),
xgb.callback.early_stop(3)])
我可以看到很多以下日志:
[17:50:22] src/tree/updater_prune.cc:74: tree pruning end, 1 roots, 4 extra nodes, 0 pruned nodes, max_depth=2
[17:50:22] src/tree/updater_prune.cc:74: tree pruning end, 1 roots, 6 extra nodes, 0 pruned nodes, max_depth=2
......
最后,我打印出 res 如下:
[0] train-merror:0.800139+0.00308927 test-merror:0.815893+0.0139572
我的问题是:
1、train-merror:0.800139和test-merror:0.815893是什么意思?是不是10个文件夹的eval数据的平均值?
2、我们什么时候需要设置num_round > 1?我对 cv() 和 train() 之间的 num_round 有误解。当 cv() 时,num_round 只是再次进行另外 10 个文件夹的交叉验证。但是当 train(), num_round 设置我想要的树数。对吗?
3、当cv()时,在一次迭代中,如果我不设置提前停止,流程什么时候结束?
4,文件夹进程结束时如何打印一些指标?
谢谢!
【问题讨论】:
-
关于问题2,我意识到这是一个愚蠢的问题。 cv() 和 train() 中的 num_round 都是同一个意思。而question3也被question2取消了