I'm trying to run OptunaSearch with a config that looks like this
config = {"algorithm": tune.choice(list(search_space.keys())),
"params": tune.sample_from(lambda spec: search_space[spec.config.algorithm]['params'])}
Where the search_space is a dict of like this
search_space = {
"algorithm_1": {
"params": {
"a": tune.randint(50, 200),
"b": tune.choice([3, 5, 7, 9]),
"c": tune.loguniform(0.001, 0.1),
},
},
"algorithm_2": {
"params": {
"a": tune.loguniform(0.1, 10),
"d": tune.loguniform(0.001, 1),
},
},
}
but I get an error saying
ValueError: Optuna search does not support parameters of type `Function` with samplers of type `NoneType`
I'm aware of this restriction, but I'm not sure how to use that "define-by-run" interface so this is possible, and also couldn't find any similar example
I tried like this
analysis = tune.run(
tune.with_parameters(self.optimize, X=X),
search_alg=OptunaSearch(),
metric="score",
mode="max",
num_samples=15,
config=config
)