I can get a gprMdl via:
rng(0,'twister');N = 100;x = linspace(-10,10,N)';y = 1 + x*5e-2 + sin(x)./x + 0.2*randn(N,1);gprMdl = fitrgp(x,y,'FitMethod','Exact','PredictMethod','Exact');
and the posterior covariance matrix via:
kfcn = gprMdl.Impl.Kernel.makeKernelAsFunctionOfXNXM(gprMdl.Impl.ThetaHat)K = kfcn(x(1:5,:),x(1:7,:))
How can I go about sampling a model from the posterior distribution of gprMdl?
To clarify, I mean like the curves from the 2nd tile of:
Being able to do this is a matter of being able to finish up a graduate program, so any help is much appreciated!
Best Answer