Thin extender over kernlab::specc that performs Ng / Jordan
/ Weiss spectral clustering on a feature matrix.
Arguments
- x
Numeric matrix or data frame of features (rows = observations).
- centers
Integer; the number of clusters to extract.
- ...
Further arguments forwarded to
kernlab::specc(e.g.kernel,kpar,nystrom.red,iterations).
Value
A list with $method = "kernlab::specc" and
$raw (a specc S4 object containing the cluster
assignments, centres and within-cluster sums of squares).
Examples
# \donttest{
if (requireNamespace("kernlab", quietly = TRUE)) {
set.seed(1)
x <- rbind(
matrix(stats::rnorm(80, mean = -2), ncol = 2),
matrix(stats::rnorm(80, mean = 2), ncol = 2)
)
morie_spectral_cluster(x, centers = 2)
}
#> $method
#> [1] "kernlab::specc"
#>
#> $raw
#> Spectral Clustering object of class "specc"
#>
#> Cluster memberships:
#>
#> 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
#>
#> Gaussian Radial Basis kernel function.
#> Hyperparameter : sigma = 4.6282344288711
#>
#> Centers:
#> [,1] [,2]
#> [1,] 2.116840 1.689608
#> [2,] -1.907974 -1.879733
#>
#> Cluster size:
#> [1] 40 40
#>
#> Within-cluster sum of squares:
#> [1] 72.28717 64.30232
#>
#>
# }
