unable to control the optimization of some hyperparameters

2 次查看(过去 30 天)
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?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with Optimization Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by