필터 지우기
필터 지우기

Use of fitrgp to solve simple example (Rasmussen book)

조회 수: 7 (최근 30일)
Jose DELGADO
Jose DELGADO 2016년 10월 30일
댓글: Jose DELGADO 2017년 5월 21일
I am learning Gaussian Processes and I am trying to replicate the canonical example of Rasmussen book. I understand it should be a simple application of fitrgp, but I cannot get it. I always get a flat response:
My idea is to have a very simple training set in a 2-D example
X=[1,3,7,10]';% those are the given points
y=[17,14,10,21]';% those are the expected responses
%Then I train a model
tbl=table(X,y);
grp=fitrgp(tbl,'y');
%and try to evaluate the fit for the interval [0,20]
xnew=linspace(0,20)';
[ypred,ysd]=predict(grp,xnew);
plot(xnew,ypred, xnew, ypred+ysd)
I was looking for something similar to Rasmussen result
But I only get a flat response
I have been looking in the web and I have found a example code that does the trick, but I understood that fitrgp should include and supersede it.
Am I correct?. Should I use some parameters with fitrgp different from the default? (I was reading/trying some of them carefully and I could not find the right combination)
Thank you in advance

채택된 답변

Gautam Pendse
Gautam Pendse 2017년 5월 20일
Hi Jose,
Function fitrgp fits the model by maximizing the marginal log likelihood. In some cases, there could be multiple local optima corresponding to different interpretations of the data. Consider initializing the noise standard deviation to a smaller value using the 'Sigma' name/value pair like this:
x = [-4;-2;-1;0;2];
y = [-2;0;1;2;-1];
gpr = fitrgp(x,y,'Sigma',0.1);
plot(x,y,'b+','DisplayName','Data');
hold on;
xtest = linspace(-5,5,1000)';
[pred,~,ci] = predict(gpr,xtest);
plot(xtest,pred,'r','DisplayName','Prediction');
hold on;
plot(xtest,ci(:,1),'c','DisplayName','Lower 95% Limit');
plot(xtest,ci(:,2),'k','DisplayName','Upper 95% Limit');
legend('show','Location','Best');
shg;
Also, have a look at this doc example which illustrates the effect of specifying initial parameter values to fitrgp:
Hope this helps,
Gautam
  댓글 수: 1
Jose DELGADO
Jose DELGADO 2017년 5월 21일
Thank you Gautam. The explanations on the help file are too short here
Thank you for your help and interest

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Gaussian Process Regression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by