computeCSC: Constrained Spectral Clustering

View source: R/sampleCompute.R

computeCSCR Documentation

Constrained Spectral Clustering

Description

Perform Constrained Spectral Clustering from a similarity matrix computation.

Usage

computeCSC(
  x,
  K = 0,
  K.max = 20,
  mustLink = list(),
  cantLink = list(),
  alphas = seq(from = 0, to = 1, length = 100)
)

Arguments

x

matrix of raw data (point by line).

K

number of clusters. If K=0 (default), this number is automatically computed thanks to the Elbow method.

K.max

maximal number of clusters (K.Max=20 by default).

mustLink

list of ML (must-link) constrained pairs.

cantLink

list of CNL (cannot-link) constrained pairs.

alphas

numeric vector for the weight of constraints considered.

Details

computeCSC performs Constrained Spectral Clustering from a similarity matrix computation

Value

res.csc results obtained from KwaySSSC algorithm.

See Also

computeSemiSupervised, KwaySSSC

Examples

dat <- rbind(matrix(rnorm(100, mean = 0, sd = 0.3), ncol = 2), 
             matrix(rnorm(100, mean = 2, sd = 0.3), ncol = 2), 
             matrix(rnorm(100, mean = 4, sd = 0.3), ncol = 2))
tf <- tempfile()
write.table(dat, tf, sep=",", dec=".")
x <- importSample(file.features=tf)

ML=list(c(sel="10",mem="20"))
CNL=list(c(sel="1",mem="140"))

res.csc <- computeCSC(x$features$preprocessed$x, K=0, mustLink=ML, cantLink=CNL)
plot(dat[,1], dat[,2], type = "p", xlab = "x", ylab = "y", 
col = res.csc$label, main = "Constrained Spectral clustering")



RclusTool documentation built on May 29, 2024, 5:23 a.m.