fastClustering: Fast Spectral Clustering

Description Usage Arguments Value Author(s) Examples

View source: R/fastClustering.R

Description

This function will sample the data before performing a classification function on the samples and then applying K nearest neighbours.

Usage

1
2
3
4
5
6
7
8
9
fastClustering(
  dataFrame,
  smplPoint,
  stopCriteria = 0.99,
  neighbours = 7,
  similarity = TRUE,
  clustFunction,
  ...
)

Arguments

dataFrame

The dataFrame.

smplPoint

maximum of sample number for reduction.

stopCriteria

criterion for minimizing intra-group distance and select final smplPoint.

neighbours

number of points that will be selected for the similarity computation.

similarity

if True, will use the similarity matrix for the clustering function.

clustFunction

the clustering function to apply on data.

...

additional arguments for the clustering function.

Value

returns a list containing the following elements:

Author(s)

Emilie Poisson Caillault and Erwan Vincent

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
### Example 1: 2 disks of the same size
n<-100 ; r1<-1
x<-(runif(n)-0.5)*2;
y<-(runif(n)-0.5)*2
keep1<-which((x*2+y*2)<(r1*2))
disk1<-data.frame(x+3*r1,y)[keep1,]
disk2 <-data.frame(x-3*r1,y)[keep1,]
sameTwoDisks <- rbind(disk1,disk2)
res <- fastClustering(scale(sameTwoDisks),smplPoint = 500, 
                      stopCriteria = 0.99, neighbours = 7, similarity = TRUE,
                      clustFunction = UnormalizedSC, K = 2)
plot(sameTwoDisks, col = as.factor(res$clustLabels))

### Example 2: Speed and Stopping Distances of Cars
res <- fastClustering(scale(iris[,-5]),smplPoint = 500, 
                      stopCriteria = 0.99, neighbours = 7, similarity = TRUE,
                      clustFunction = spectralPAM, K = 3)
plot(iris, col = as.factor(res$clustLabels))
table(res$clustLabels,iris$Species)

sClust documentation built on Aug. 24, 2021, 1:06 a.m.