library(BayesGPfit)
library(lattice)
set.seed(1227)
dat = list()
dat$x = GP.generate.grids(d=2L,num_grids = 100)
curve = GP.simulate.curve.fast(dat$x,a=0.01,b=0.5,poly_degree=20L)
dat$f = curve$f + rnorm(length(curve$f),sd=1)
fast_fit = GP.fast.Bayes.fit(dat$f,dat$x,a=0.01,b=0.5,poly_degree=20L,progress_bar = TRUE)
reg_fit = GP.Bayes.fit(dat$f,dat$x,a=0.01,b=0.5,poly_degree=20L,progress_bar = TRUE)
curves = list(True = curve,
Bayes_fast = fast_fit,
Bayes = reg_fit)
GP.plot.curves(curves,
main="Comparisons of Bayesian model fitting")
Run the code above in your browser using DataLab