Skip to content

Instantly share code, notes, and snippets.

@dlozeve
Created March 21, 2019 16:13
Show Gist options
  • Save dlozeve/caa67d115ad20bc10b42ba80352b1314 to your computer and use it in GitHub Desktop.
Save dlozeve/caa67d115ad20bc10b42ba80352b1314 to your computer and use it in GitHub Desktop.
Gaussian Process Sampling
using LinearAlgebra
using Distributions
using Plots
plotly()
m(x) = 0.25*x^2
k(x,y) = exp(-0.5 * (x-y)^2)
xmin = -5
xmax = 5
ns = 51
keps = 1e-9
xs = range(xmin, xmax, length=ns)
mu = m.(xs)
sigma = k.(xs, xs') + keps*Matrix{Float64}(I, ns, ns)
d = MvNormal(mu, sigma)
display(scatter(xs, rand(d)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment