Hi, there is a problem when I try to call the bayesopt function (inbuilt function) from Julia, here is a simple example, and it will give an error like follows.
Unable to use a value of type table as an index. Error in @(tbl)matlab_jl_2(tbl) Error in BayesianOptimization/callObjNormally (line 2576) Objective = this.ObjectiveFcn(conditionalizeX(this, X)); Error in BayesianOptimization/callObjFcn (line 481) = callObjNormally(this, X); Error in BayesianOptimization/runSerial (line 1996) ObjectiveFcnObjectiveEvaluationTime, ObjectiveNargout] = callObjFcn(this, this.XNext); Error in BayesianOptimization/run (line 1948) this = runSerial(this); Error in BayesianOptimization (line 457) this = run(this); Error in bayesopt (line 323) Results = BayesianOptimization(Options);
As I know, within matlab, the variables are transfered to
mdlfun() in type of table, here I just want to run the objective function in Julia (cause it’s fast), and use matlab
bayesopt function (cause it’s convenient), thanks in advance for any suggestions
using MATLAB function f(x, y) return -x - y end function mdlfun(tbl) x = tbl.v1 y = tbl.v2 return f(x, y) end mat""" xrange = optimizableVariable('v1',[-2,2],'Type','real'); yrange = optimizableVariable('v2',[-5,5],'Type','real'); var=[xrange yrange]; bayesObject =bayesopt(@(tbl)$mdlfun(tbl),var,... 'MaxObjectiveEvaluations',50) """