Reference: Brendan J. Frey and Delbert Dueck, ?Clustering by Passing Messages Between Data Points?, Science Feb. 2007 print(__doc__)
from sklearn.cluster import AffinityPropagation
from sklearn import metrics
from sklearn.datasets.samples_generator import make_blobs
Generate sample data centers = [[1, 1], [-1, -1], [1, -1]]
X, labels_true = make_blobs(n_samples=300, centers=centers, cluster_std=0.5,
random_state=0)
Compute Affinity Propagation af = AffinityPropag