Skip to content

Add Prefix Parameter to lts for Tuning Spaces in Pipelines? #51

@giuseppec

Description

@giuseppec

I wanted to use a search space for a pipeline and tried to rename the tuning space:

task = tsk("boston_housing")
tuner = tnr("random_search", batch_size = 3)

# Potentially large ML pipeline
xgb = as_learner(po("encode") %>>% lrn("regr.xgboost"))

search_space = lts("regr.xgboost.default")
# My attempt to rename the tuning space so that it matches the expected parameter names:
names(search_space$values) = paste0("regr.xgboost.", names(search_space$values)

at = auto_tuner(
  tuner = tuner,
  learner = xgb,
  search_space = search_space,
  resampling = rsmp("cv", folds = 2),
  measure = msr("regr.mse"),
  term_time = 20
)

at$train(task)

Maybe it could be useful to be able to allow passing a prefix to lts such as lts("regr.xgboost.default", param_set_prefix = "regr.xgboost.")?

The workaround is to use xgb = as_learner(po("encode") %>>% lts(lrn("regr.xgboost"))) maybe this can be mentioned in the book here?
Currently, the book only mentions that this is possible without mentioning a use case: "We could also apply the default search spaces from Bischl et al. (2023) by passing the learner to [lts()]".
Maybe one could add 1-2 more sentences to highlight that this can be useful if one wants to tune the learner parameters when the learner is combined with other pipeops?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions