Created
March 21, 2019 16:13
-
-
Save dlozeve/caa67d115ad20bc10b42ba80352b1314 to your computer and use it in GitHub Desktop.
Gaussian Process Sampling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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