【发布时间】: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