How to set arguments of 'fitrgp' while using 'bayesopt'?

4 views (last 30 days)
'bayesopt' uses 'fitrgp' to fit GP regression model. However, it seems that 'bayesopt' does not provide an interface to set the arguments of the inner 'fitrgp'. How can I set these arguments?
To be more specific, is it possible to force 'fitrpg' to use 'sr' as 'FitMethod' when using 'bayesopt'?

Accepted Answer

Don Mathis
Don Mathis on 23 Mar 2017
You're right that bayesopt doesn't provide an interface for that. If you're willing to modify a source code file it can be done pretty easily. Go to line 3118 of BayesianOptimization.m
>> edit BayesianOptimization.m
It's in the function 'iFitrgpRobust'. The line looks like this:
GP = compact(fitrgp(X, Y, varargin{:}, 'SigmaLowerBound', SigmaLowerBound));
You can then add arguments to the end of this argument list. Suppose you wanted to use fitmethod 'sd' with an active set size of 300. You could do this:
GP = compact(fitrgp(X, Y, varargin{:}, 'SigmaLowerBound', SigmaLowerBound, ...
'FitMethod', 'sd', 'ActiveSetSize', 300));
By the way, would you mind sharing your reason for wanting to do this? I have a guess but I would like to hear from you. Thanks.
  2 Comments
Mengshuo Wang
Mengshuo Wang on 23 Mar 2017
Hi Don, thanks a lot for your detailed answer. I want to change the fitting method (as well as the predicting method) just because I hope to reduce the computing time of bayesopt. I found bayesopt gets rather slow when the iteration number grows high (>100,) and I thought using sparse methods might help.
Don Mathis
Don Mathis on 24 Mar 2017
That was my guess :-). Your solution is exactly what I would recommend -- Use SD and set the active set size to some value that is fast enough for your problem. That number will depend on your problem, so you'll need to adjust it for each problem. I have used this technique and I find it works well.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!