This page

Citing

Please consider citing the scikit-learn.

9.7.5. sklearn.cluster.AffinityPropagation

class sklearn.cluster.AffinityPropagation(damping=0.5, max_iter=200, convit=30, copy=True)

Perform Affinity Propagation Clustering of data

Parameters :

damping : float, optional

Damping factor

max_iter : int, optional

Maximum number of iterations

convit : int, optional

Number of iterations with no change in the number of estimated clusters that stops the convergence.

copy: boolean, optional :

Make a copy of input data. True by default.

Notes

See examples/plot_affinity_propagation.py for an example.

Reference:

Brendan J. Frey and Delbert Dueck, “Clustering by Passing Messages Between Data Points”, Science Feb. 2007

The algorithmic complexity of affinity propagation is quadratic in the number of points.

Attributes

cluster_centers_indices_ array, [n_clusters] Indices of cluster centers
labels_ array, [n_samples] Labels of each point

Methods

fit: Compute the clustering
__init__(damping=0.5, max_iter=200, convit=30, copy=True)
fit(S, p=None)

compute MeanShift

Parameters :

S: array [n_points, n_points] :

Matrix of similarities between points

p: array [n_points,] or float, optional :

Preferences for each point

damping : float, optional

Damping factor

copy: boolean, optional :

If copy is False, the affinity matrix is modified inplace by the algorithm, for memory efficiency

set_params(**params)

Set the parameters of the estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The former have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns :self :