Skip to contents

Thin extender over kernlab::specc that performs Ng / Jordan / Weiss spectral clustering on a feature matrix.

Usage

morie_spectral_cluster(x, centers, ...)

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

if (FALSE) { # \dontrun{
  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)
  }
} # }