External Variables in bayesopt Objective Function

조회 수: 3 (최근 30일)
Daniel Gordon
Daniel Gordon 2019년 1월 25일
답변: Walter Roberson 2019년 1월 25일
Hello,
I am making use of bayesopt within Matlab. According to the documentation, the objective function must have the following signature:
result = objectiveFunction(X)
where X is a struct/table giving the values of the optimisation variables to be used to analyse the objective function at this particular iteration.
My issue is that the objective function I wish to use depends on some external variables as well as X. To be clear, these external variables will never change throughout a single Bayesian optimisation, and so they are not themselves optimisation variables. In theory they could be hard coded in to the objective function itself, but this would not be very efficient to run multiple experiments.
As an example: one external variable I need is 'model_file'. This is set before the bayesopt starts and defines a model which is loaded & used to perform some dynamic calculations within the objective function. Typically every time we run a new experiment either the model_file or other external variables are changed.
Currently I am considering solutions whereby the external variables are defined globally in the script which runs bayesopt, but I was wondering if there is a nicer solution to this? Ideally I would have something like:
result = objectiveFunction(X, external_variables)
But it seems like this is not possible?

채택된 답변

Walter Roberson
Walter Roberson 2019년 1월 25일

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by