【问题标题】:Error related to labels when tuning catboost in tidymodels在 tidymodels 中调整 catboost 时与标签相关的错误
【发布时间】:2021-10-04 01:27:12
【问题描述】:

这是模型:

cb_spec <- boost_tree(
  mode = "classification",
  trees = 1000,
  tree_depth = tune(),
  min_n = tune(),
  mtry = tune(),
  learn_rate = tune()
) %>%
  set_engine("catboost", loss_function = "Logloss", task_type = "GPU")

配方如下:

cb_rec <- recipe(covid_vaccination ~ ., data = cb_train) %>% 
  step_unknown(all_nominal_predictors()) %>%
  #step_dummy(all_nominal_predictors(), one_hot = TRUE) %>%
  step_impute_median(all_numeric_predictors()) %>% 
  step_nzv(all_predictors())

我把它们结合起来:

cb_wf <- workflow() %>% 
  add_model(cb_spec) %>% 
  add_recipe(cb_rec)

然后我尝试调整以找到最佳超参数:

cb_tune <- tune_grid(
  object = cb_wf,
  resamples = cb_folds,
  grid = cb_grid,
  metrics = metric_set(roc_auc),
  control = control_grid(verbose = TRUE)
)

这是我得到的错误:

catboost.from_matrix(as.matrix(float_and_cat_features_data) 中的错误, : 不支持的标签类型,需要双精度或整数。

我已经确认将分类变量更改为因子。我的数据集中绝对没有字符类型向量。

【问题讨论】:

  • 我收到错误:Error: Engine 'catboost' is not supported for "boost_tree()". See "show_engines('boost_tree")".
  • 你能添加一个可重现的例子吗?
  • 抱歉,最近在 catboost github 中通过一个可重现的示例解决了这个问题,如果您愿意,我可以链接该问题。但我要结束这个问题。
  • 我明白了.. 但现在你得到了我上面提到的the same error
  • @captcoma,删除并重新安装您的软件包,尤其是重新安装 treesnip 叉。 Glemhel 说这对他有用,而且现在似乎也对我有用。

标签: r tidymodels catboost


【解决方案1】:

https://github.com/catboost/catboost/issues/1874

感谢某个很棒的人制作了自己的 treesnip 叉作为解决方法:Mikhail Rudakov

【讨论】:

  • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
猜你喜欢
  • 2018-04-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-11-10
  • 2019-08-14
相关资源
最近更新 更多