8.1.2.4. sklearn.cluster.affinity_propagation¶
- sklearn.cluster.affinity_propagation(S, p=None, convit=30, max_iter=200, damping=0.5, copy=True, verbose=False)¶
Perform Affinity Propagation Clustering of data
Parameters : S: array [n_points, n_points] :
Matrix of similarities between points
p: array [n_points,] or float, optional :
Preferences for each point - points with larger values of preferences are more likely to be chosen as exemplars. The number of exemplars, ie 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 (resulting in a moderate number of clusters). For a smaller amount of clusters, this can be set to the minimum value of the similarities.
damping : float, optional
Damping factor
copy: boolean, optional :
If copy is False, the affinity matrix is modified inplace by the algorithm, for memory efficiency
verbose: boolean, optional :
The verbosity level
Returns : cluster_centers_indices: array [n_clusters] :
index of clusters centers
labels : array [n_points]
cluster labels for each point
Notes
See examples/plot_affinity_propagation.py for an example.
References
Brendan J. Frey and Delbert Dueck, “Clustering by Passing Messages Between Data Points”, Science Feb. 2007