Description Usage Arguments Value References Examples
View source: R/rclust.hclust.R
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.
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
)
|
input |
a S3 object of |
type |
type of distance, either |
method |
the agglomeration method to be used. This must be (an unambiguous abbreviation of) one of |
members |
|
an object of class hclust
. See hclust
for details.
mullner_fastcluster_2013RiemBaseExt
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.