Machine Learning, Clustering, Affinity Propagation, Python, Unsupervised Learning.
as np import matplotlib.pyplot as plt from sklearn.cluster import AffinityPropagation from sklearn.datasets import make_blobs centers = [[1, 1], [-1, -1], [1, -1]] X, labels_true = make_blobs(n_samples=300, centers=centers, cluster_std=0.5, random_state=42) plt.figure(figsize=(10, 6))