Not enough input arguments for 'bayesopt'?
Mostra commenti meno recenti
Hello,
I just started with MATLAB today and was doing most of my work in Python so far. I need to use MATLAB for some specific project and im lost. I wanted to use BayesianOptimization tool 'bayesopt', but i can't seem to get it to work even for simple tasks.
My code:
x=optimizableVariable('x1',[-1 1]);
BayesObject=bayesopt(fun1,[x]);
fun1(0);
function y=fun(x)
y=x^2;
end
function [objective] = fun1(x)
objective=x^2
end
Which returns errors:
>> PythonTest
Not enough input arguments.
Error in PythonTest>fun1 (line 13)
objective=x.^2
Error in PythonTest (line 3)
BayesObject=bayesopt(fun1,[x]);
I hope someone can help me. Thank you very much.
Risposte (1)
Alan Weiss
il 13 Mar 2019
1 voto
Please look at the documentation on Bayesian objective functions. The bayesopt solver passes a table to the objective function. To access variables in the table, use dot notation.
function y = fun(t)
y = t.x1^2;
end
Alan Weiss
MATLAB mathematical toolbox documentation
2 Commenti
Luka Znidaric
il 13 Mar 2019
Aden Lee
il 18 Mag 2020
Mind to share what changes you have made to your code ? I'm interested.
Categorie
Scopri di più su Downloads in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!