Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add periodic kernel for HSGP #1691

Open
avehtari opened this issue Sep 28, 2024 · 1 comment
Open

Add periodic kernel for HSGP #1691

avehtari opened this issue Sep 28, 2024 · 1 comment
Labels
Milestone

Comments

@avehtari
Copy link
Contributor

brms has now all other HSGP kernels from HSGP paper except periodic. The code for the HSGP paper periodic is

matrix PHI_periodic(int N, int M, real w0, vector x) {
  matrix[N,M] mw0x = diag_post_multiply(rep_matrix(w0*x, M), linspaced_vector(M, 1, M));
  return append_col(cos(mw0x), sin(mw0x));
}
vector diagSPD_periodic(real alpha, real rho, int M) {
  real a = 1/rho^2;
  vector[M] q = exp(log(alpha) + 0.5 * (log(2) - a + to_vector(log_modified_bessel_first_kind(linspaced_int_array(M, 1, M), a))));
  return append_row(q,q);
}

where M is the number of basis functions, w0 is the period length (fine to be fixed as part of gp() arguments), and rho is the lengthscale.

@paul-buerkner
Copy link
Owner

paul-buerkner commented Sep 30, 2024

Thanks! I will implement periodic kernels in the next release. Linking #234 (comment) for further references.

@paul-buerkner paul-buerkner added this to the brms 2.23.0 milestone Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants