I'm trying to apply conditional constraints on two variable with bayesopt
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
here are part the paramters i'm trying to optimize
optimVars = [optimizableVariable('numlayers',[20 25],'Type','integer')
optimizableVariable('LR',[1e-3 1e-1],'Transform','log')
optimizableVariable('MBS',[20 32],'Type','integer')
optimizableVariable('RP',[1e-3 1e-1],'Transform','log')];
function Xnew = condvariablefcn(X)
Xnew=X;
Xnew.L2Regularization(Xnew.numLayersToFreeze==24) = NaN;
end
but when i run the code, i get this message :
Error using BayesianOptimization/applyXConstraint
The XConstraintFcn must return a logical column vector the same height as
its input (10000), but it returned an object of class table with size
[10000 4].
the code runs fine before i added this constraint. so what is the problem with the function?
0 Commenti
Risposte (1)
Alan Weiss
il 2 Ago 2022
I think that you set the wrong name-value argument for your constraint function. bayesopt thinks that you are using an XConstraint, not a conditional constraint. In your bayesopt call set the name-value argument like this:
results = bayesopt(fun,vars,'ConditionalVariableFcn',@condvariablefcn)
Alan Weiss
MATLAB mathematical toolbox documentation
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!