R xgboost, Gamma 回归问题

标签 r xgboost

我正在玩 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/

相关文章:

XGBoost:参数 'objective'设置的是什么?

r - 预测 AUC 1 的集成模型

python - 无法打开 pickle 的 Sagemaker XGBoost 模型

r - 翻转表格中的列/行

css - R Shiny CondtionalPanel 不使用 CSS 样式表

随机化或排列 data.frame 中的值

json - 将Json文件读取到没有嵌套列表的data.frame中

r - 如何使用多个变量但相同的分割进行交叉制表(xtabs)

python - 如何使用带有 GridSearchCV 对象的 TimeSeriesSplit 来调整 scikit-learn 中的模型?

r - XG-Boost : predict(. ..,preleaf = T) - 结果意味着什么?