rclust.hclust: Hierarchical Agglomerative Clustering for Manifold-valued...

Description Usage Arguments Value References Examples

View source: R/rclust.hclust.R

Description

Hierarchical clustering is a generally applicable clustering algorithm as long as we have concept of dissimilarity. We adopt hclust algorithm by fastcluster package. See hclust for more details.

Usage

1
2
3
4
5
6
7
rclust.hclust(
  input,
  type = c("extrinsic", "intrinsic"),
  method = c("single", "complete", "average", "mcquitty", "ward.D", "ward.D2",
    "centroid", "median"),
  members = NULL
)

Arguments

input

a S3 object of riemdata class. See riemfactory for more details.

type

type of distance, either "intrinsic" or "extrinsic".

method

the agglomeration method to be used. This must be (an unambiguous abbreviation of) one of "single", "complete", "average", "mcquitty", "ward.D", "ward.D2", "centroid" or "median".

members

NULL or a vector whose length equals the number of observations. See hclust for details.

Value

an object of class hclust. See hclust for details.

References

\insertRef

mullner_fastcluster_2013RiemBaseExt

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
## generate 50 points near (0,0,1)  and
##          50 points near (0,0,-1) on Sphere S^2 
ndata = 50
theta = seq(from=-0.99,to=0.99,length.out=ndata)*pi
tmpx  = cos(theta) + rnorm(ndata,sd=0.1)
tmpy  = sin(theta) + rnorm(ndata,sd=0.1)

## wrap it as 'riemdata' class
data  = list()
for (i in 1:ndata){
  tgt = c(tmpx[i],tmpy[i],1)
  data[[i]] = tgt/sqrt(sum(tgt^2)) # project onto Sphere
}
for (i in 1:ndata){
  tgt = c(tmpx[i],tmpy[i],-1)
  data[[i+ndata]] = tgt/sqrt(sum(tgt^2)) # project onto Sphere
}
data = RiemBase::riemfactory(data, name="sphere")

## compare extrinsic and intrinsic hierarchical clustering
hext <- rclust.hclust(data, type="extrinsic")
hint <- rclust.hclust(data, type="intrinsic")

## visualize
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,2), pty="s")
plot(hext, main="extrinsic+single")
plot(hint, main="intrinsic+single")
par(opar)

RiemBaseExt documentation built on March 26, 2020, 5:52 p.m.