mlr 中的警告 "NA used as a default value for learner parameter missing" 是什么意思?
What does the warning "NA used as a default value for learner parameter missing" mean in mlr?
我是运行通过mlr包分类的xgboost。我的数据中有缺失值,我想保留这些值(也就是说,我想保留这些观察结果并且我想避免插补)。我知道 mlr 中的 xgboost 实现可以处理缺失值。但是,我不明白mlr的makeLearner函数提供的警告。
我尝试阅读文档并在其他人的代码中发现了这个警告。但是我还没有看到以对我有意义的方式处理的警告。
例如,我已经阅读了关于警告的讨论,但它并没有为我澄清一些事情:
https://github.com/mlr-org/mlr/pull/1225
调用makeLearner函数时出现警告:
xgb_learner <- makeLearner(
"classif.xgboost",
predict.type = "prob",
par.vals = list(
objective = "binary:logistic",
eval_metric = "error",
nrounds = 200,
missing = NA,
max_depth = 6,
eta = 0.1,
gamma = 5,
colsample_bytree = 0.5,
min_child_weight = 1,
subsample = 0.7
)
)
Warning in makeParam(id = id, type = "numeric", learner.param = TRUE, lower = lower, :
NA used as a default value for learner parameter missing.
ParamHelpers uses NA as a special value for dependent parameters.
我的缺失值目前被编码为缺失值(即 NA)。很明显,R 从以下位置识别它们:
> sum(is.na(training$day))
[1] 58
从getParamSet函数来看,参数missing似乎是从-Inf到Inf取数值。因此,也许 NA 不是有效值?
> getParamSet("classif.xgboost")
Warning in makeParam(id = id, type = "numeric", learner.param = TRUE, lower = lower, :
NA used as a default value for learner parameter missing.
ParamHelpers uses NA as a special value for dependent parameters.
Type len Def Constr Req Tunable Trafo
booster discrete - gbtree gbtree,gblinear,dart - TRUE -
watchlist untyped - <NULL> - - FALSE -
eta numeric - 0.3 0 to 1 - TRUE -
gamma numeric - 0 0 to Inf - TRUE -
max_depth integer - 6 1 to Inf - TRUE -
min_child_weight numeric - 1 0 to Inf - TRUE -
subsample numeric - 1 0 to 1 - TRUE -
colsample_bytree numeric - 1 0 to 1 - TRUE -
colsample_bylevel numeric - 1 0 to 1 - TRUE -
num_parallel_tree integer - 1 1 to Inf - TRUE -
lambda numeric - 1 0 to Inf - TRUE -
lambda_bias numeric - 0 0 to Inf - TRUE -
alpha numeric - 0 0 to Inf - TRUE -
objective untyped - binary:logistic - - FALSE -
eval_metric untyped - error - - FALSE -
base_score numeric - 0.5 -Inf to Inf - FALSE -
max_delta_step numeric - 0 0 to Inf - TRUE -
missing numeric - -Inf to Inf - FALSE -
我是否需要将这些重新编码为特定值,然后传递给 mlr(通过 makeLearner 中的 missing = [特定值])?做点别的?或者这个警告不是引起关注的原因?
非常感谢您的澄清。
此警告来自 ParamHelpers,在这种情况下是无害的。这是不考虑特定情况的标准检查。
我是运行通过mlr包分类的xgboost。我的数据中有缺失值,我想保留这些值(也就是说,我想保留这些观察结果并且我想避免插补)。我知道 mlr 中的 xgboost 实现可以处理缺失值。但是,我不明白mlr的makeLearner函数提供的警告。
我尝试阅读文档并在其他人的代码中发现了这个警告。但是我还没有看到以对我有意义的方式处理的警告。
例如,我已经阅读了关于警告的讨论,但它并没有为我澄清一些事情: https://github.com/mlr-org/mlr/pull/1225
调用makeLearner函数时出现警告:
xgb_learner <- makeLearner(
"classif.xgboost",
predict.type = "prob",
par.vals = list(
objective = "binary:logistic",
eval_metric = "error",
nrounds = 200,
missing = NA,
max_depth = 6,
eta = 0.1,
gamma = 5,
colsample_bytree = 0.5,
min_child_weight = 1,
subsample = 0.7
)
)
Warning in makeParam(id = id, type = "numeric", learner.param = TRUE, lower = lower, :
NA used as a default value for learner parameter missing.
ParamHelpers uses NA as a special value for dependent parameters.
我的缺失值目前被编码为缺失值(即 NA)。很明显,R 从以下位置识别它们:
> sum(is.na(training$day))
[1] 58
从getParamSet函数来看,参数missing似乎是从-Inf到Inf取数值。因此,也许 NA 不是有效值?
> getParamSet("classif.xgboost")
Warning in makeParam(id = id, type = "numeric", learner.param = TRUE, lower = lower, :
NA used as a default value for learner parameter missing.
ParamHelpers uses NA as a special value for dependent parameters.
Type len Def Constr Req Tunable Trafo
booster discrete - gbtree gbtree,gblinear,dart - TRUE -
watchlist untyped - <NULL> - - FALSE -
eta numeric - 0.3 0 to 1 - TRUE -
gamma numeric - 0 0 to Inf - TRUE -
max_depth integer - 6 1 to Inf - TRUE -
min_child_weight numeric - 1 0 to Inf - TRUE -
subsample numeric - 1 0 to 1 - TRUE -
colsample_bytree numeric - 1 0 to 1 - TRUE -
colsample_bylevel numeric - 1 0 to 1 - TRUE -
num_parallel_tree integer - 1 1 to Inf - TRUE -
lambda numeric - 1 0 to Inf - TRUE -
lambda_bias numeric - 0 0 to Inf - TRUE -
alpha numeric - 0 0 to Inf - TRUE -
objective untyped - binary:logistic - - FALSE -
eval_metric untyped - error - - FALSE -
base_score numeric - 0.5 -Inf to Inf - FALSE -
max_delta_step numeric - 0 0 to Inf - TRUE -
missing numeric - -Inf to Inf - FALSE -
我是否需要将这些重新编码为特定值,然后传递给 mlr(通过 makeLearner 中的 missing = [特定值])?做点别的?或者这个警告不是引起关注的原因?
非常感谢您的澄清。
此警告来自 ParamHelpers,在这种情况下是无害的。这是不考虑特定情况的标准检查。