AggExResult-class {apcluster} | R Documentation |
Class "AggExResult"
Description
S4 class for storing results of exemplar-based agglomerative clustering
Objects
Objects of this class can be created by calling aggExCluster
for a given similarity matrix.
Slots
The following slots are defined for AggExResult objects:
l
:number of samples in the data set
sel
:subset of samples used for leveraged clustering (empty for normal clustering)
maxNoClusters
:maximum number of clusters in the cluster hierarchy, i.e. it contains clusterings with 1 -
maxNoClusters
clusters.exemplars
:list of length
maxNoClusters
; thei
-th component of the list is a vector ofi
exemplars (corresponding to the level withi
clusters).clusters
:list of length
maxNoClusters
; thei
-th component ofclusters
is a list ofi
clusters, each of which is a vector of sample indices.merge
:a
maxNoClusters-1
by 2 matrix that contains the merging hierarchy; fully analogous to the slotmerge
in the classhclust
.height
:a vector of length
maxNoClusters-1
that contains the merging objective of each merge; largely analogous to the slotheight
in the classhclust
except that the slotheight
inAggExResult
objects is supposed to be non-increasing, sinceaggExCluster
is based on similarities, whereashclust
uses dissimilarities.order
:a vector containing a permutation of indices that can be used for plotting proper dendrograms without crossing branches; fully analogous to the slot
order
in the classhclust
.labels
:a character vector containing labels of clustered objects used for plotting dendrograms.
sim
:similarity matrix; only available if
aggExCluster
was called with similarity function andincludeSim=TRUE
.call
:method call used to produce this clustering result
Methods
- plot
signature(x="AggExResult")
: seeplot-methods
- plot
signature(x="AggExResult", y="matrix")
: seeplot-methods
- heatmap
signature(x="AggExResult")
: seeheatmap-methods
- heatmap
signature(x="AggExResult", y="matrix")
: seeheatmap-methods
- show
signature(object="AggExResult")
: seeshow-methods
- cutree
signature(object="AggExResult", k="ANY", h="ANY")
: seecutree-methods
- length
signature(x="AggExResult")
: gives the number of clustering levels in the clustering result.- as.hclust
signature(x="AggExResult")
: seecoerce-methods
- as.dendrogram
signature(object="AggExResult")
: seecoerce-methods
Accessors
In the following code snippets, x
is an AggExResult
object.
- [[
signature(x="AggExResult", i="index", j="missing")
:x[[i]]
returns an object of classExClust
corresponding to the clustering level withi
clusters; synonymous tocutree(x, i)
.- [
signature(x="AggExResult", i="index", j="missing", drop="missing")
:x[i]
returns a list ofExClust
objects with all clustering levels specified in vectori
. So, the list has as many components as the argumenti
has elements. A list is returned even ifi
is a single level.- similarity
signature(x="AggExResult")
: gives the similarity matrix.
Author(s)
Ulrich Bodenhofer, Johannes Palme, and Johannes Palme
References
https://github.com/UBod/apcluster
Bodenhofer, U., Kothmeier, A., and Hochreiter, S. (2011) APCluster: an R package for affinity propagation clustering. Bioinformatics 27, 2463-2464. DOI: doi:10.1093/bioinformatics/btr406.
See Also
aggExCluster
, show-methods
,
plot-methods
, cutree-methods
Examples
## create two Gaussian clouds
cl1 <- cbind(rnorm(50, 0.2, 0.05), rnorm(50, 0.8, 0.06))
cl2 <- cbind(rnorm(50, 0.7, 0.08), rnorm(50, 0.3, 0.05))
x <- rbind(cl1, cl2)
## compute similarity matrix (negative squared Euclidean)
sim <- negDistMat(x, r=2)
## compute agglomerative clustering from scratch
aggres1 <- aggExCluster(sim)
## show results
show(aggres1)
## plot dendrogram
plot(aggres1)
## plot heatmap along with dendrogram
heatmap(aggres1, sim)
## plot level with two clusters
plot(aggres1, x, k=2)
## run affinity propagation
apres <- apcluster(sim, q=0.7)
## create hierarchy of clusters determined by affinity propagation
aggres2 <- aggExCluster(sim, apres)
## show results
show(aggres2)
## plot dendrogram
plot(aggres2)
## plot heatmap
heatmap(aggres2, sim)
## plot level with two clusters
plot(aggres2, x, k=2)