Clear Filters
Clear Filters

unable to control the optimization of some hyperparameters

2 views (last 30 days)
I'm trying to optimize the hyperparmeters (number of layers and number of nodes in each layer) for a Stacked auto encoder as follows:
optimVars = [optimizableVariable('numLayers',[1 3],'Type','integer') % number of layers
optimizableVariable('layer1_Size',[500 1000],'Type','integer') % number of nodes in the first layer
optimizableVariable('layer2_Size',[500 400],'Type','integer') % number of nodes in the 2nd layer
optimizableVariable('layer3_Size',[400 50],'Type','integer') % number of nodes in the 3rd layer
];
but this way I'm facing a problem which is for example: when the optimizer runs an iteration with numbLayers=1, the
optimzer will optimize the last two variables (layer2_Size & layer3_Size) which in such a case are not needed to optimize because
the only variable needs to be optimized in this case is "layer1_Size" . Is there any way to solve this problem by setting a variable on/off depending on another variable value?

Answers (0)

Categories

Find more on Get Started with Optimization 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!