Clear Filters
Clear Filters

How to using bayesopt function for a GP model

3 views (last 30 days)
Hi, I need to use bayesopt function for a GP model but it returns NaN and Error. I used the code below and the x is a 2 * n matrix and y is a 1*n matrix. Can anyone help me?
num = optimizableVariable('n',[1,10],'Type','integer');
dst = optimizableVariable('dst',{'chebychev','euclidean','minkowski'},'Type','categorical');
results = bayesopt(@(params)fitrgp(x',y,'Sigma',0.1),[num,dst],'Verbose',0,...

Accepted Answer

Don Mathis
Don Mathis on 21 Jun 2019
It looks like you're basing your code on this example, which is a good starting point:
But it seems you removed some important parts, like the call to kfoldLoss for example.
I would recommend starting with that example and making incremental changes to turn it into a solution to your problem. And reading the bayesopt documentation.
  1 Comment
zhikun ruan
zhikun ruan on 22 Jun 2019
Thanks Don. I found your answers in other problems are very helpful. Thank you very much.

Sign in to comment.

More Answers (0)


Find more on Sequence and Numeric Feature Data Workflows 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!