-
-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enable HSGPs for the exponential kernel #234
- Loading branch information
1 parent
898c504
commit 7838419
Showing
5 changed files
with
90 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ Package: brms | |
Encoding: UTF-8 | ||
Type: Package | ||
Title: Bayesian Regression Models using 'Stan' | ||
Version: 2.22.0 | ||
Date: 2024-09-20 | ||
Version: 2.22.1 | ||
Date: 2024-09-24 | ||
Authors@R: | ||
c(person("Paul-Christian", "Bürkner", email = "[email protected]", | ||
role = c("aut", "cre")), | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* Spectral density function of a Gaussian process with exponential kernel | ||
* also known as the Matern 1/2 kernel | ||
* Args: | ||
* x: array of numeric values of dimension NB x D | ||
* sdgp: marginal SD parameter | ||
* lscale: vector of length-scale parameters | ||
* Returns: | ||
* numeric vector of length NB of the SPD evaluated at 'x' | ||
*/ | ||
vector spd_gp_exponential(data array[] vector x, real sdgp, vector lscale) { | ||
int NB = dims(x)[1]; | ||
int D = dims(x)[2]; | ||
int Dls = rows(lscale); | ||
real constant = square(sdgp) * | ||
(2^D * pi()^(D / 2.0) * tgamma((D + 1.0) / 2)) / sqrt(pi()); | ||
real expo = -(D + 1.0) / 2; | ||
vector[NB] out; | ||
if (Dls == 1) { | ||
// one dimensional or isotropic GP | ||
real lscale2 = square(lscale[1]); | ||
constant = constant * lscale[1]^D; | ||
for (m in 1:NB) { | ||
out[m] = constant * (1 + lscale2 * dot_self(x[m]))^expo; | ||
} | ||
} else { | ||
// multi-dimensional non-isotropic GP | ||
vector[Dls] lscale2 = square(lscale); | ||
constant = constant * prod(lscale); | ||
for (m in 1:NB) { | ||
out[m] = constant * (1 + dot_product(lscale2, square(x[m])))^expo; | ||
} | ||
} | ||
return out; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.