Skip to content

How to apply search space to AutoFSelector #41

Answered by be-marc
ShixiangWang asked this question in Q&A
Discussion options

You must be logged in to vote
library(mlr3tuning)
library(mlr3fselect)
library(mlr3learners)

task = tsk("pima")

# feature selection on pima data set
fselect_instance = fselect(
    method = "random_search",
    task = task,
    learner = lrn("classif.xgboost", nrounds = 100),
    resampling = rsmp("cv", folds = 3),
    measure = msr("classif.ce"),
    term_evals = 10
)


# subset task to selected features
task$select(fselect_instance$result_feature_set)

# tune rpart on pima data set
tuning_instance = tune(
  method = "grid_search",
  task = task,
  learner = lrn("classif.xgboost", nrounds = to_tune(100, 1000)),
  resampling = rsmp("cv", folds = 3),
  measure = msr("classif.ce"),
  term_evals = 10,
  resolution = 5
)

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ShixiangWang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #38 on October 07, 2021 21:58.