View source: R/120_ClusteringConfig.R
| setup_SpectralRBF | R Documentation |
Setup a SpectralRBFConfig object for spectral clustering with a Gaussian
(radial basis function) kernel, via the 'kernlab' package.
setup_SpectralRBF(
k = 3L,
sigma = NULL,
sigma_sample_fraction = NULL,
iterations = 200L,
nystrom = NULL,
features = NULL
)
k |
Integer [2, Inf): Number of clusters. Must be no more than the number of cases. |
sigma |
Optional Numeric (0, Inf): Inverse kernel width. Unset estimates it from the data. |
sigma_sample_fraction |
Optional Numeric (0, 1]: Fraction of the cases the kernel width is estimated from when |
iterations |
Integer [1, Inf): Maximum number of k-means iterations run on the spectral embedding. |
nystrom |
Optional |
features |
Optional Character vector: Names of at least 2 distinct
feature columns to cluster on. |
Spectral clustering builds a similarity graph over the cases, embeds them in the leading eigenvectors of that graph's normalized Laplacian, and runs k-means there. Groups that are connected but not compact – concentric rings, elongated bands – separate in that embedding while k-means on the raw features cannot find them. This variant measures similarity with a Gaussian kernel whose width is shared by every case; see setup_SpectralLocal for a per-case width and setup_SpectralLaplace for an exponential kernel.
The cost is cubic in the number of cases, since the whole affinity matrix
is decomposed. Pass nystrom to approximate the decomposition from a
sample instead.
Argument names are rtemis' own. They map to kernlab::specc() as: k ->
centers, sigma -> kpar = list(sigma) with kernel = "rbfdot",
sigma_sample_fraction -> mod.sample (with kpar = "automatic" when
sigma is unset), nystrom -> nystrom.red and nystrom.sample;
iterations keeps its name.
SpectralRBFConfig object.
EDG
Ng AY, Jordan MI, Weiss Y (2001). On Spectral Clustering: Analysis and an Algorithm. Advances in Neural Information Processing Systems, 14, 849-856.
spectral_config <- setup_SpectralRBF(k = 3L)
spectral_config
setup_SpectralRBF(k = 3L, nystrom = setup_Nystrom(sample = 100L))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.