From 104fc0c95c4f16a1f9a45c1b46eb9b4225909100 Mon Sep 17 00:00:00 2001 From: Pierre-Edouard Portier Date: Sun, 29 Jan 2023 17:53:32 +0100 Subject: [PATCH] minor. rename gausskernel fnc --- 19_nystroem_approximation_code.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/19_nystroem_approximation_code.R b/19_nystroem_approximation_code.R index 49b8aac..b289f03 100644 --- a/19_nystroem_approximation_code.R +++ b/19_nystroem_approximation_code.R @@ -1,6 +1,6 @@ # compute the gaussian kernel between each row of X1 and each row of X2 # should be done more efficiently -gausskernel <- +gausskernel.nakr <- function(X1, X2, sigma2) { n1 <- dim(X1)[1] @@ -34,7 +34,7 @@ function(X, y, sigma2=NULL, lambda=1E-4, landmarks=NULL, nb.landmarks=NULL) X <- scale(X) y <- scale(y) - C <- gausskernel(X, as.matrix(X[splidx,]), sigma2) + C <- gausskernel.nakr(X, as.matrix(X[splidx,]), sigma2) K11 <- C[splidx,] svdK11 <- svd(K11) @@ -80,7 +80,7 @@ function(o, newdata) } newdata <- scale(newdata,center=attr(o$X,"scaled:center"), scale=attr(o$X,"scaled:scale")) - Ktest <- gausskernel(newdata, as.matrix(o$X[o$splidx,]), o$sigma2) + Ktest <- gausskernel.nakr(newdata, as.matrix(o$X[o$splidx,]), o$sigma2) yh <- Ktest %*% o$beta yh <- (yh * attr(o$y,"scaled:scale")) + attr(o$y,"scaled:center") }