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

transforming 2 levels ParamUty class in nested cross-validation #347

Open
The-Killbill opened this issue Apr 17, 2021 · 0 comments
Open

Comments

@The-Killbill
Copy link

'num_nodes' hyperparameter in Param_set of 'surv.deephit' learner is a ParamUty class with default value: 32, 32.
To optimize that with two random num_nodes, I wrote the code below:

search_space <- ps(num_nodes = p_fct(list(c(32,64,128,256)), trafo = function(x) c(sample(x,1), sample(x,1))))

to check that:

generate_design_random(search_space,10)$transpose()

Which showed:

[[1]]$num_nodes
[1] 64 128

[[2]]$num_nodes
[1] 32 256

...

But when I added it to a nested cross validation model to find its optimized value , It included all factors instead of randomly selected two of them, briefly as follows (just include column of num_nodes):

# Code :
...
#defining autotuner
at <- AutoTuner$new(dh.learner, resampling, measure, terminator, tuner, search_space)

#outer cross validation
resamplin_outer <- rsmp('cv', folds = 3)

# nested resampling
nest_rsm <- resample(task.mlr, at, resampling_outer)

Which showed:

  num_nodes 
   c(32,64,128,256)
    num_nodes
   c(32,64,128,256)
   ... 

So, how is it possible to transform parameters with ParamUty class with more than one level, which can be applied to nested cross validation?

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

1 participant