I'm trying to apply conditional constraints on two variable with bayesopt
조회 수: 6 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Alan Weiss
2022년 8월 2일
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!