Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR infomation : argument "task" is missing, with no default #139

Open
wyfwps opened this issue May 2, 2024 · 1 comment
Open

ERROR infomation : argument "task" is missing, with no default #139

wyfwps opened this issue May 2, 2024 · 1 comment

Comments

@wyfwps
Copy link

wyfwps commented May 2, 2024

Run the codes as below, the error came as "Error in assert_class(task, "Task", .var.name = .var.name) : argument "task" is missing, with no default"


library(tidyverse)
library(mlr3verse)
boston = tsk("boston_housing")
str(boston$data())

prep = po("encode", method = "treatment",
affect_columns = selector_name("chas")) %>>%
po("encodeimpact",
affect_columns = selector_name("town"))
boston = prep$train(boston)[[1]]
set.seed(123)
split = partition(boston, ratio = 0.8)
learner = lrn("regr.glmnet", alpha = 0) # 需要 glmnet 包
search_space = ps(
s = p_dbl(lower = 0.001, upper = 2))
at = auto_tuner(
tuner = tnr("random_search"),
learner = learner,
resampling = rsmp("cv", folds = 3L), # 3 折交叉验证
measure = msr("regr.rmse"), # 评估指标选 rmse
search_space = search_space,
term_evals = 10) # 计算 10 次终止

set.seed(123)
at$train(boston, row_ids = split$train)
learner$param_set$values =
at$tuning_result$learner_param_vals[[1]]
learner$train(boston, row_ids = split$train)
autoplot(learner,taks=boston)

@bblodfon
Copy link
Contributor

Hi @wyfwps! Can you please copy your code, run reprex::reprex(), and then copy-paste the result in the above post? Would be helpful to add the library versions as well with devtools::session_info(). The last line has a taks instead of task, maybe that's the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants