r - 使用 xgboost 函数时出现 XGBoost 错误

标签 r xgboost

这是我的代码:

xgb <- xgboost(data = as.matrix(df_all_combined), 
               label = as.matrix(target_train), 
               eta = 0.1,
               max_depth = 15, 
               nround=100, 
               subsample = 0.5,
               colsample_bytree = 0.5,
               seed = 1,
               eval_metric = "auc",
               objective = "binary:logistic",
               num_class = 12,
               nthread = 3)

得到以下错误:

Error in xgb.iter.update(bst$handle, dtrain, iteration - 1, obj) : [09:17:34] amalgamation/../src/objective/regression_obj.cc:90: Check failed: (preds.size()) == (info.labels.size()) labels are not correctly providedpreds.size=840756, label.size=70063



谁能帮我解决这个问题?无法弄清楚问题。

最佳答案

尝试从您的参数中删除 num_class = 12 。

关于r - 使用 xgboost 函数时出现 XGBoost 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41775721/

相关文章:

r - R 是否有像 Java 的 PriorityQueue 一样的优先级队列?

r - 如何使用特异性和敏感性指标之和作为 R 插入符中训练的汇总指标?

python - 在 Anaconda 3 windows-64 上安装 xgboost

r - 如何在 R 包 XGBoost 中为 xgb.cv 指定训练和测试索引

带 lapply 的稳健线性回归

r - 使用条件组合在数据框中子集行

r - devtools::install_git 通过 SSH

r - 两个或多个数据帧的平均单元格

machine-learning - 尽管已编译为 GPU 运行,但通过 Scikit learn API 的 XGB 似乎并未在 GPU 中运行

machine-learning - 如何为 XGBoost XGBRanker 准备特征和标签?