preferenceRange | R Documentation |
Determines meaningful ranges for affinity propagation input preference
## S4 method for signature 'matrix'
preferenceRange(s, exact=FALSE)
## S4 method for signature 'Matrix'
preferenceRange(s, exact=FALSE)
## S4 method for signature 'dgTMatrix'
preferenceRange(s, exact=FALSE)
## S4 method for signature 'sparseMatrix'
preferenceRange(s, exact=FALSE)
s |
an |
exact |
flag indicating whether exact ranges should be computed,
which is relatively slow; if bounds are sufficient,
supply |
Affinity Propagation clustering relies on an appropriate choice of input preferences. This function helps in finding a good choice by determining meaningful lower and upper bounds.
If the similarity matrix s
is sparse or if it contains
-Inf
similarities, only the similarities are taken into account
that are specified in s
and larger than -Inf
. In such
cases, the lower bound returned by preferenceRange
need not
correspond to one or two clusters. Moreover, it may also happen in
degenerate cases that the lower bound exceeds the upper bound.
In such a case, no warning or error is issued, so it is the user's
responsibility to ensure a proper interpretation of the results.
The method apclusterK
makes use of this function
internally and checks the plausibility of the result
returned by preferenceRange
.
returns a vector with two entries, the first of which is the minimal input preference (which would lead to 1 or 2 clusters) and the second of which is the maximal input prefence (which would lead to as many clusters as data samples).
Ulrich Bodenhofer and Andreas Kothmeier
https://github.com/UBod/apcluster
Frey, B. J. and Dueck, D. (2007) Clustering by passing messages between data points. Science 315, 972-976. DOI: \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1126/science.1136800")}.
Bodenhofer, U., Kothmeier, A., and Hochreiter, S. (2011) APCluster: an R package for affinity propagation clustering. Bioinformatics 27, 2463-2464. DOI: \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/bioinformatics/btr406")}.
apcluster
## 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)
## create similarity matrix
sim <- negDistMat(x, r=2)
## determine bounds
preferenceRange(sim)
## determine exact range
preferenceRange(sim, exact=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.