DensityCut: The densityCut algorithm

Description Usage Arguments Value Examples

Description

The densityCut algorithm

Usage

1
2
3
4
DensityCut(X, K, knn.index, knn.dist, V, D, G, threshold, alpha = 0.9,
  nu = seq(0, 1, by = 0.05), adjust = TRUE, maxit = 50, eps = 1e-05,
  col, show.plot = TRUE, show.tip.label = FALSE, debug = FALSE,
  xlab = TRUE, text = NULL, ...)

Arguments

X

A data matrix (columns are features and rows are data points)

K

A integer to specify the number of neighbours in building the Knn graph. Default to K=\log_2(N), where N is the number of data points

knn.index

An N*K data matrix for the nearest neighbour indices

knn.dist

An N*K data matrix for the nearest neighbour distances

V

The initial density vector of length N

D

The dimensionality of data

G

A sparse Knn graph, reseaved for extension

threshold

A number between 0 and 1 specifying the saliency index to cut the tree. If not specified, it is selecting by stability analysis of the clustering tree

alpha

The damping factor between 0 and 1, default to 0.90

nu

The saliency index in merging trees, default to seq(0.0, 1.0, by=0.05)

adjust

Lotical, whether to ajdust valley height or not

maxit

The maximum number of iteration allowed in density refinement, default to 50

eps

The threshold in density refinement, default to 1e-5

col

A vector of clours

show.plot

Logical, whether to draw clustering results

show.tip.label

Logical, whether to draw the tip labels of trees

debug

Logical, whether to print debug information

xlab

Logical, whether to show the xlab

text

subplot label

...

Reserved for extension

Value

A list contains the clustering memberships, the modes of each cluster, and the estimated densities at each point

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
library(mvtnorm)

data(distinct.col)
set.seed(0)

N = 2^12
number.cluster = 64
N = N / number.cluster

i  = j = seq(-3.5, 3.5, by=1)
mu = expand.grid(i, j)
mu = as.matrix(mu)

sigma = matrix(c(1, 0, 0, 1)*0.05, byrow=TRUE, nrow=2)

x = lapply(seq(number.cluster), function(z) rmvnorm(N, mu[z,], sigma))
x = do.call(rbind, x)

label = lapply(1:number.cluster, function(z) rep(z, N))
col = AssignLabelColor(distinct.col, unlist(label))
NeatPlot(x, col=col, pch=4, cex=0.5)

K = ceiling(log2(N * number.cluster))
a = DensityCut(X=x, K=K, alpha=0.85, nu=seq(0.0, 1.0, by=0.05),
               debug=FALSE, show.plot=TRUE,
               col=distinct.col)

col = AssignLabelColor(distinct.col, a$cluster)
NeatPlot(x, col=col, pch=4, cex=0.5)

poipou/CytoSEE documentation built on May 13, 2019, 6:15 p.m.