Bayesian Optimization Output Functions within Matlab App
5 views (last 30 days)
Show older comments
Hi,
I'm trying to implement an optimization process, based on the bayesopt method, integrated into a GUI, made with application designer. Everything works fine except for the output function, which I'm having trouble with the arguments.
In the help section, the description is relatively straight forqward as
results = bayesopt(fun,vars,'OutputFcn',@outputfun,...
implying the automatic arguments results and state.
However, when calling a function within an app, I need to also supply the argument app. I tried several ways, including an anonymous function like
outFunc = @(x)outputFunction(app,x.results,x.state);
but just can't make it work. Depending on the formatting and whether or not uing the anonymous function, I always get one of the following two errors:
- Dot indexing is not supported for variables of this type.
- Too many input arguments.
Maybe (and even hopefully) it's an obvious mistake with an easy fix. Does anyone know a solution to this?
Thank you!
1 Comment
Ulrich Streppel
on 20 Jan 2023
is there any solution in the meanwhile? I have the same problem. How can the app argument integrated into an output function in app designer?
Answers (1)
Alan Weiss
on 8 Aug 2021
I don't know what you mean "when calling a function within an app, I need to also supply the argument app."
However, maybe I can help. As explained in Bayesian Optimization Output Functions, an output function takes the signature
stop = outputfun(results,state)
So you might need the signature
@(results,state)outputfun(results,state)
But as far as I know that is the same as
@outputfun
so I am not sure that my advice is going to change anything for you.
Alan Weiss
MATLAB mathematical toolbox documentation
See Also
Categories
Find more on R Language in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!