View source: R/nystrom_embedding.R
nystrom_approx | R Documentation |
Approximate the eigen-decomposition of a large kernel matrix using either the standard Nyström method or the Double Nyström method.
nystrom_approx(
X,
kernel_func = NULL,
ncomp = min(dim(X)),
landmarks = NULL,
nlandmarks = 10,
preproc = pass(),
method = c("standard", "double"),
l = NULL,
use_RSpectra = TRUE,
...
)
X |
A numeric matrix or data frame of size (N x D), where N is number of samples. |
kernel_func |
A kernel function with signature |
ncomp |
Number of components (eigenvectors/eigenvalues) to return. |
landmarks |
A vector of row indices (of X) specifying the landmark points.
If NULL, |
nlandmarks |
The number of landmark points to sample if |
preproc |
A pre-processing pipeline (default |
method |
Either "standard" (the classic single-stage Nyström) or "double" (the two-stage Double Nyström method). |
l |
Intermediate rank for the double Nyström method. Ignored if |
use_RSpectra |
Logical. If TRUE, use |
... |
Additional arguments passed to |
The Double Nyström method introduces an intermediate step that reduces the size of the decomposition problem, potentially improving efficiency and scalability.
A bi_projector
object with fields:
v
The eigenvectors (N x ncomp) approximating the kernel eigenbasis.
s
The scores (N x ncomp) = v * diag(sdev), analogous to principal component scores.
sdev
The square roots of the eigenvalues.
preproc
The pre-processing pipeline used.
set.seed(123)
X <- matrix(rnorm(1000*1000), 1000, 1000)
# Standard Nyström
res_std <- nystrom_approx(X, ncomp=5, nlandmarks=20, method="standard")
# Double Nyström
res_db <- nystrom_approx(X, ncomp=5, nlandmarks=20, method="double", l=10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.