MATLAB: Problem with function handle for Basis function in fitrgp

fitrgpgaussian process regressiongaussian regression

I like to use a custom Basis function for fitrgp.
beta0 = [1.5,2.0];
hfcn = @(X) (beta0(1).*(X).^beta0(2));
This should be a powerMean-function.
If I call:
gprMdl1 = fitrgp(x,y,'BasisFunction',hfcn,'Beta',beta0)
with dummy-data from:
load(fullfile(matlabroot,'examples','stats','gprdata2.mat'))
I get
gprMdl1.Beta = 0.0019
Why is gprMdl1.Beta not 1×2 like beta0? Is it posible to optimize custom parameters in Basis function (like beta0)?

Best Answer

load(fullfile(matlabroot,'examples','stats','gprdata2.mat'))
In this case, your x is n x 1;
hfcn returns H, which has size n x 1; i.e. p = 1;
So if you want to provide 'Beta' to fitrgp(), it should be of size p x 1, i.e 1 x 1.
fitrgp() is only using your beta0(1) as Adam mentioned in the comment.