Is it possible to create an optimizableVariable of integer type as an array with step different from 1?
Show older comments
Hello everyone!
I'm trying to perform a Bayesian optimization to find the best hyperparameters for a deep neural network and I want the variable MiniBatchSize to just have, in this case, three possible values: 8, 10, 12. I thought I could declare optVar as if it was an array
interval = 8:2:12;
optVar = optimizableVariable('MiniBatchSize', interval, 'Type', 'integer');
This code raises the following error:
Error using optimizableVariable/checkRange
'Range' value must be a string array, a cell array of character vectors, or a numeric vector of length 2.
Am I missing something? Is there another way to perform this?
Thanks in advance.
Accepted Answer
More Answers (1)
Walter Roberson
on 6 Mar 2021
1 vote
Optimization variable 1 to 3 and multiply by 2 and add 6.
3 Comments
Jon Gutiérrez Zaballa
on 6 Mar 2021
Walter Roberson
on 6 Mar 2021
Ah, sorry, I didn't realize that the Stats toolbox had its own kind of variable creation; the instructions I gave were for Problem-Based Optimization
Jon Gutiérrez Zaballa
on 6 Mar 2021
Categories
Find more on Get Started with Statistics and Machine Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!