gpt4 book ai didi

R xgboost, Gamma 回归问题

转载 作者:行者123 更新时间:2023-12-05 07:47:01 26 4
gpt4 key购买 nike

我正在玩 xgboost,有一些财务数据,想尝试 Gamma 回归作为目标。

cvs <- xgb.cv(data = sparse_matrix, label = target, nfold = 10, nthread = 4, nround = 16, objective = "reg:gamma", metrics = list("mae"))

但这似乎比使用线性回归作为目标需要更长的时间。

并且还会抛出很多以下警告:

In foldVector[which(y == dimnames(numInClass)$y[i])] <- sample(seqVector) :
number of items to replace is not a multiple of replacement length

此警告重复约 50 次。

这是怎么回事?我不应该使用 reg:gamma 作为目标吗,因为 reg:linear 工作得很好,我只是在玩,只是想尝试各种目标

谁能指出为什么会出现这些警告?

最佳答案

我的回答有点晚了,但可能对其他人有帮助。我在 reg:logistic 目标上遇到了同样的问题,我解决它的方法是在 xgb.cv 中设置 stratified=FALSE/p>

根据 xgboost 文档,stratified 是一个 bool 值,指示是否应根据结果标签的值对折叠采样进行分层。

关于R xgboost, Gamma 回归问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40264403/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com