I am trying to cluster my datasets using affinity propagation. I followed this and this links to grasp the basics of affinity propagation clustering. The sample code available at sklearn is as follows:
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 = AffinityPropagation(preference=-50).fit(X)
cluster_centers_indices = af.cluster_centers_indices_
labels = af.labels_
While running it, it works as stated on the website. However, I could not understand it completely. I want to modify this code to use with my datasets. My datasets consist of values from different sensors on a 2-D surface. I want to cluster the values with similar sensors readings at various points on the 2-D surface. How can I do it?
Thank you.