R: Class "APResult"

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 `apcluster` or `apclusterL`)

`netsim`:

  final total net similarity, defined as the sum of `expref` and `dpsim` (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 `apcluster` was called with `details=TRUE`

`exprefAll`:

  vector containing the sum of preferences of the identified exemplars for each iteration; only available if `apcluster` was called with `details=TRUE`

`dpsimAll`:

  vector containing the sum of similarities of data points to exemplars for each iteration; only available if `apcluster` was called with `details=TRUE`

`idxAll`:

  matrix with sample-to-exemplar indices for each iteration; only available if `apcluster` was called with `details=TRUE`

### Extends

Class `"ExClust"`, directly.

### Methods

plot

  `signature(x="APResult")`: see `plot-methods`

plot

  `signature(x="ExClust", y="matrix")`: see `plot-methods`

heatmap

  `signature(x="ExClust")`: see `heatmap-methods`

heatmap

  `signature(x="ExClust", y="matrix")`: see `heatmap-methods`

show

  `signature(object="APResult")`: see `show-methods`

labels

  `signature(object="APResult")`: see `labels-methods`

cutree

  `signature(object="APResult")`: see `cutree-methods`

length

  `signature(x="APResult")`: gives the number of clusters.

sort

  `signature(x="ExClust")`: see `sort-methods`

as.hclust

  `signature(x="ExClust")`: see `coerce-methods`

as.dendrogram

  `signature(object="ExClust")`: see `coerce-methods`

### Accessors

In the following code snippets, `x` is an `APResult` object.

  `x[[i]]`: Returns the i-th cluster as a list of indices of samples belonging to the i-th cluster.

  `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 argument `i` has elements. A list is returned even if `i` is a single integer.

similarity

  `signature(x="APResult")`: gives the similarity matrix.

### Author(s)

Ulrich Bodenhofer, Andreas Kothmeier & Johannes Palme apcluster@bioinf.jku.at

### References

http://www.bioinf.jku.at/software/apcluster

Bodenhofer, U., Kothmeier, A., and Hochreiter, S. (2011) APCluster: an R package for affinity propagation clustering. Bioinformatics 27, 2463-2464. DOI: 10.1093/bioinformatics/btr406.

Frey, B. J. and Dueck, D. (2007) Clustering by passing messages between data points. Science 315, 972-976.

### 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)

[Package apcluster version 1.4.7 Index]