In [ ]:
using SparseBayes
using Winston
Next, to ensure the repeatability of what is going to follow, we execute the following.
In [ ]:
srand(1000);
In [ ]:
N = 100;
noiseStd = 0.1;
X = hcat(10 * (-1:2/(N-1):1));
Ytrue = sin(abs(X)) ./ abs(X);
Y = Ytrue + noiseStd * randn(N, 1);
Let us plot our synthetic data.
In [ ]:
plot(X, Y, "r*")
oplot(X, Ytrue, "g")
In [ ]:
sigma = 0.3;
kernelFun(X1, X2) = kernelGaussian(X1, X2, sigma);
mdl = RVMGaussianModel(kernelFun);
Next, we can fit the model to our data.
In [ ]:
@time fit!(mdl, X, Y[:,1]);