computeCSC: Constrained Spectral Clustering

Description Usage Arguments Details Value See Also Examples

View source: R/sampleCompute.R

Description

Perform Constrained Spectral Clustering from a similarity matrix computation.

Usage

1
2
3
4
5
6
7
8
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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, dir.save=tempdir())

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 Feb. 4, 2020, 5:08 p.m.