kkmeans {kernlab}R Documentation

Kernel k-means

Description

A weigthed kernel version of the famous k-means algorithm.

Usage

## S4 method for signature 'formula':
kkmeans(x, data = NULL, na.action = na.omit, ...)

## S4 method for signature 'matrix':
kkmeans(x, centers, kernel = "rbfdot", kpar = list(sigma = 0.1),alg="kkmeans", p=1, na.action = na.omit, ...)

Arguments

x the matrix of data to be clustered or a symbolic description of the model to be fit.
data an optional data frame containing the variables in the model. By default the variables are taken from the environment which `kkmeans' is called from.
centers Either the number of clusters or a set of initial cluster centers. If the first, a random set of rows in the eigenvectors matrix are chosen as the initial centers.
kernel the kernel function used in training and predicting. This parameter can be set to any function, of class kernel, which computes a dot product between two vector arguments. kernlab provides the most popular kernel functions which can be used by setting the kernel parameter to the following strings:
  • rbfdot Radial Basis kernel function "Gaussian"
  • polydot Polynomial kernel function
  • vanilladot Linear kernel function
  • tanhdot Hyperbolic tangent kernel function
  • laplacedot Laplacian kernel function
  • besseldot Bessel kernel function
  • anovadot ANOVA RBF kernel function
  • splinedot Spline kernel
The kernel parameter can also be set to a user defined function of class kernel by passing the function name as an argument.
kpar
alg the algorithm to use. Options currently include kkmeans and kerninghan.
p a parameter used to keep the affinity matrix positive semidefinite
na.action The action to perform on NA
... additional parameters

Details

The algorithm is implemented using the triangle inequality to avoid unnecessary and computational expensive distance calculations. This leads to significant speedup particularly on large data sets with a high number of clusters. With a particular choice of weights this algorithm becomes equivalent to Kernighan-Lin, and the norm-cut graph partitioning algorithms.

Value

An S4 object of class specc wich extends the class vector containing integers indicating the cluster to which each point is allocated. The following slots contain useful information

centers A matrix of cluster centers.
size The number of point in each cluster
withinss The within-cluster sum of squares for each cluster
kernelf The kernel function used

Author(s)

Alexandros Karatzoglou
alexandros.karatzoglou@ci.tuwien.ac.at

References

Inderjit Dhillon, Yuqiang Guan, Brian Kulis
A Unified view of Kernel k-means, Spectral Clustering and Graph Partitioning
UTCS Technical Report
http://www.cs.utexas.edu/users/kulis/pubs/spectral_techreport.pdf

See Also

specc, kpca, kcca

Examples

## Cluster the iris data set.
data(iris)

sc <- kkmeans(as.matrix(iris[,-5]), centers=3)

sc
centers(sc)
size(sc)
withinss(sc)


[Package kernlab version 0.6-2 Index]