| APResult-class {apcluster} | R Documentation |
Class "APResult"
Description
S4 class for storing results of affinity propagation
clustering. It extends the class ExClust.
Objects
Objects of this class can be created by calling apcluster
or apclusterL for a given similarity matrix or calling
one of these procedures with a data set and a similarity measure.
Slots
The following slots are defined for APResult objects. Most names are taken from Frey's and Dueck's original Matlab package:
sweeps:number of times leveraged clustering ran with different subsets of samples
it:number of iterations the algorithm ran
p:input preference (either set by user or computed by
apclusterorapclusterL)netsim:final total net similarity, defined as the sum of
exprefanddpsim(see below)dpsim:final sum of similarities of data points to exemplars
expref:final sum of preferences of the identified exemplars
netsimLev:total net similarity of the individual sweeps for leveraged clustering; only available for leveraged clustering
netsimAll:vector containing the total net similarity for each iteration; only available if
apclusterwas called withdetails=TRUEexprefAll:vector containing the sum of preferences of the identified exemplars for each iteration; only available if
apclusterwas called withdetails=TRUEdpsimAll:vector containing the sum of similarities of data points to exemplars for each iteration; only available if
apclusterwas called withdetails=TRUEidxAll:matrix with sample-to-exemplar indices for each iteration; only available if
apclusterwas called withdetails=TRUE
Extends
Class "ExClust", directly.
Methods
- plot
signature(x="APResult"): seeplot-methods- plot
signature(x="ExClust", y="matrix"): seeplot-methods- heatmap
signature(x="ExClust"): seeheatmap-methods- heatmap
signature(x="ExClust", y="matrix"): seeheatmap-methods- show
signature(object="APResult"): seeshow-methods- labels
signature(object="APResult"): seelabels-methods- cutree
signature(object="APResult"): seecutree-methods- length
signature(x="APResult"): gives the number of clusters.- sort
signature(x="ExClust"): seesort-methods- as.hclust
signature(x="ExClust"): seecoerce-methods- as.dendrogram
signature(object="ExClust"): seecoerce-methods
Accessors
In the following code snippets, x is an APResult object.
- [[
signature(x="APResult", i="index", j="missing"):x[[i]]returns the i-th cluster as a list of indices of samples belonging to the i-th cluster.- [
signature(x="APResult", i="index", j="missing", drop="missing"):x[i]returns a list of integer vectors with the indices of samples belonging to this cluster. The list has as many components as the argumentihas elements. A list is returned even ifiis a single integer.- similarity
signature(x="APResult"): gives the similarity matrix.
Author(s)
Ulrich Bodenhofer, Andreas Kothmeier, Johannes Palme
References
https://github.com/UBod/apcluster
APCluster: an R package for affinity propagation clustering. Bioinformatics 27, 2463-2464. DOI: doi:10.1093/bioinformatics/btr406.
Frey, B. J. and Dueck, D. (2007) Clustering by passing messages between data points. Science 315, 972-976. DOI: doi:10.1126/science.1136800.
See Also
apcluster, apclusterL,
show-methods, plot-methods,
labels-methods, cutree-methods
Examples
## create two Gaussian clouds
cl1 <- cbind(rnorm(100, 0.2, 0.05), rnorm(100, 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)
## run affinity propagation
apres <- apcluster(sim, details=TRUE)
## show details of clustering results
show(apres)
## plot information about clustering run
plot(apres)
## plot clustering result
plot(apres, x)
## plot heatmap
heatmap(apres, sim)