Skip to contents

This is a wrapper around the Python class sklearn.cluster.AffinityPropagation.

References

  • Brendan J. Frey and Delbert Dueck (2007). Clustering by Passing Messages Between Data Points, Science.

Super classes

rgudhi::PythonClass -> rgudhi::SKLearnClass -> rgudhi::BaseClustering -> AffinityPropagation

Methods

Inherited methods


Method new()

The AffinityPropagation class constructor.

Usage

AffinityPropagation$new(
  damping = 0.5,
  max_iter = 200L,
  convergence_iter = 15L,
  copy = TRUE,
  preference = NULL,
  affinity = c("euclidean", "precomputed"),
  verbose = FALSE,
  random_state = NULL
)

Arguments

damping

A numeric value specifying the damping factor in the range \([0.5, 1.0)\) which is the extent to which the current value is maintained relative to incoming values (weighted 1 - damping). This avoids numerical oscillations when updating these values (messages). Defaults to 0.5.

max_iter

An integer value specifying the maximum number of iterations. Defaults to 200L.

convergence_iter

An integer value specifying the number of iterations with no change in the number of estimated clusters that stops the convergence. Defaults to 15L.

copy

A boolean value specifying whether to make a copy of input data. Defaults to TRUE.

preference

A numeric value or numeric vector specifying the preferences for each point. Points with larger values of preferences are more likely to be chosen as exemplars. The number of exemplars, i.e. of clusters, is influenced by the input preferences value. If the preferences are not passed as arguments, they will be set to the median of the input similarities. Defaults to NULL.

affinity

A string specifying the affinity to use. At the moment "precomputed" and "euclidean" are supported. "euclidean" uses the negative squared euclidean distance between points. Defaults to "euclidean".

verbose

A boolean value specifying whether to be verbose. Defaults to FALSE.

random_state

An integer value specifying the seed of the random generator. Defaults to NULL which uses current time. Set it to a fixed integer for reproducible results across function calls.

Returns

An object of class AffinityPropagation.


Method clone()

The objects of this class are cloneable with this method.

Usage

AffinityPropagation$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

if (FALSE) { # reticulate::py_module_available("sklearn.cluster")
cl <- AffinityPropagation$new()
}