Interpolate Matlab inbuilt function with Julia

조회 수: 4 (최근 30일)
xu supeng
xu supeng 2022년 2월 21일
댓글: xu supeng 2022년 2월 21일
Hi, I have a problem when I try to interpolate Matlab inbuilt function bayesopt with Julia function, in my program, I try to use julia to evaluate my objective function, since it's fast, but I also want to use matlab bayesopt to optimize it, since julia's package is not that complete, it's almost work, but has a problem with variable type, here is an simple example, and the error as follows,
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)
"""
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);
  댓글 수: 2
xu supeng
xu supeng 2022년 2월 21일
Maybe I am wrong, since evry code within
mat"""..."""
will be run in Matlab that's not what I hope, but any suggestions are welcome
xu supeng
xu supeng 2022년 2월 21일
To be clear, I write this within julia and call bayesopt from julia, that's why I define functions in different ways

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Model Building and Assessment에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by