Rational quadratic covariance function derivatives wrt hyperparameters
1 |
1 2 3 4 5 6 7 8 9 10 11 12 | point1 = matrix(rnorm(1), ncol=1)
point2 = matrix(rnorm(1), ncol=1)
beta = rnorm(3) # Logarithms of variance, length scale & alpha
library(numDeriv)
Ks.2points = vapply(cov.RQ.d(point1, point2, beta=beta), function(K) {
K[1,1]
}, numeric(1))
Ks.2points.num = grad(function(beta_) {
as.numeric(cov.RQ(point1, point2, beta=beta_))
}, x=beta)
stopifnot(all.equal(Ks.2points, Ks.2points.num))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.