RiemGrassmann (version 0.1.0)

gr.hclust: Hierarchical Agglomerative Clustering on Grassmann Manifold

Description

Given the type of distance measure and agglomeration scheme method, gr.hclust performs hierarchical clustering on Grassmann manifold using fastcluster package, which returns the same object as stats package's implementation while providing more efficient computation. See hclust for more details.

Usage

gr.hclust(
  input,
  type = c("Intrinsic", "Extrinsic", "Asimov", "Binet-Cauchy", "Chordal",
    "Fubini-Study", "Martin", "Procrustes", "Projection", "Spectral"),
  method = c("single", "complete", "average", "mcquitty", "ward.D", "ward.D2",
    "centroid", "median"),
  members = NULL
)

Arguments

input

either an array of size \((n\times k\times N)\) or a list of length \(N\) whose elements are \((n\times k)\) orthonormal basis (ONB) on Grassmann manifold.

type

type of distance measure. measure. Name of each type is Case Insensitive and hyphen can be omitted.

method

he 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.

Examples

Run this code
# NOT RUN {
## generate a dataset with two types of Grassmann elements
#  group1 : first four columns of (8x8) identity matrix + noise
#  group2 : last  four columns of (8x8) identity matrix + noise

mydata = list()
sdval  = 0.25
diag8  = diag(8)
for (i in 1:10){
  mydata[[i]] = qr.Q(qr(diag8[,1:4] + matrix(rnorm(8*4,sd=sdval),ncol=4)))
}
for (i in 11:20){
  mydata[[i]] = qr.Q(qr(diag8[,5:8] + matrix(rnorm(8*4,sd=sdval),ncol=4)))
}

## try hierarchical clustering with "intrinsic" distance
opar <- par(no.readonly=TRUE)
hint <- gr.hclust(mydata, type="intrinsic")
plot(hint, main="intrinsic+single")
par(opar)

# }
# NOT RUN {
## do hierarchical clustering with different distance measures
alltypes = c("intrinsic","extrinsic","asimov","binet-cauchy",
"chordal","fubini-study","martin","procrustes","projection","spectral")
ntypes   = length(alltypes)

opar <- par(no.readonly=TRUE)
par(mfrow=c(2,5), pty="s")
for (i in 1:ntypes){
  hout = gr.hclust(mydata, type=alltypes[i])
  plot(hout, main=paste0("hclust::",alltypes[i]))
}
par(opar)
# }
# NOT RUN {
# }

Run the code above in your browser using DataCamp Workspace