"specc"(x, data = NULL, na.action = na.omit, ...)
"specc"(x, centers, kernel = "rbfdot", kpar = "automatic", nystrom.red = FALSE, nystrom.sample = dim(x)[1]/6, iterations = 200, mod.sample = 0.75, na.action = na.omit, ...)
"specc"(x, centers, nystrom.red = FALSE, iterations = 200, ...)
"specc"(x, centers, kernel = "stringdot", kpar = list(length=4, lambda=0.5), nystrom.red = FALSE, nystrom.sample = length(x)/6, iterations = 200, mod.sample = 0.75, na.action = na.omit, ...)kernelMatrix, or a list of character vectors.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
stringdot String kernel
The kernel parameter can also be set to a user defined function of class kernel by passing the function name as an argument.
"automatic" uses a heuristic to determine a
suitable value for the width parameter of the RBF kernel.
The second option "local" (local scaling) uses a more advanced heuristic
and sets a width parameter for every point in the data set. This is
particularly useful when the data incorporates multiple scales.
A list can also be used containing the parameters to be used with the
kernel function. Valid parameters for existing kernels are :
sigma inverse kernel width for the Radial Basis
kernel function "rbfdot" and the Laplacian kernel "laplacedot".
degree, scale, offset for the Polynomial kernel "polydot"
scale, offset for the Hyperbolic tangent kernel
function "tanhdot"
sigma, order, degree for the Bessel kernel "besseldot".
sigma, degree for the ANOVA kernel "anovadot".
length, lambda, normalized for the "stringdot" kernel
where length is the length of the strings considered, lambda the
decay factor and normalized a logical parameter determining if the
kernel evaluations should be normalized.
Hyper-parameters for user defined kernels can be passed through the kpar parameter as well.
TRUE a sample of the dataset is used to calculate the
eigenvalues, thus only a $n x m$ matrix where $n$ the sample size
is stored in memory (default: FALSEspecc which extends the class vector
containing integers indicating the cluster to which
each point is allocated. The following slots contain useful informationkmeans on the embedded points usually
leads to good performance. It can be shown that spectral clustering methods boil down to
graph partitioning.
The data can be passed to the specc function in a matrix or a
data.frame, in addition specc also supports input in the form of a
kernel matrix of class kernelMatrix or as a list of character
vectors where a string kernel has to be used.kkmeans, kpca, kcca ## Cluster the spirals data set.
data(spirals)
sc <- specc(spirals, centers=2)
sc
centers(sc)
size(sc)
withinss(sc)
plot(spirals, col=sc)
Run the code above in your browser using DataLab