bufflib.cluster.kmeans_cluster

bufflib.cluster.kmeans_cluster(data, n_clusters=3)

Perform KMeans clustering on data and plot the clustered points.

Parameters:
  • data (list of tuples or numpy.ndarray) – The data points in the format [(xi, yi), …].

  • n_clusters (int) – The number of clusters to create (default is 3).

Returns:

A list of lists, with the i-th element of the returned list being a list of members of the i-th cluster.