

.. _example_cluster_plot_affinity_propagation.py:


=================================================
Demo of affinity propagation clustering algorithm
=================================================

Reference:
Brendan J. Frey and Delbert Dueck, "Clustering by Passing Messages
Between Data Points", Science Feb. 2007




.. image:: images/plot_affinity_propagation_1.png
    :align: center


**Script output**::

  Estimated number of clusters: 4
  Homogeneity: 0.865
  Completeness: 0.712
  V-measure: 0.781
  Adjusted Rand Index: 0.777
  Adjusted Mutual Information: 0.710
  Silhouette Coefficient: 0.667



**Python source code:** :download:`plot_affinity_propagation.py <plot_affinity_propagation.py>`

.. literalinclude:: plot_affinity_propagation.py
    :lines: 11-
    