k-means object clustering
This is a 2D object clustering with k-means algorithm.
 
Code Link
- Mapping.kmeans_clustering.kmeans_clustering.kmeans_clustering(rx, ry, nc)[source]
- Performs k-means clustering on the given dataset, iteratively adjusting cluster centroids until convergence within a defined threshold or reaching the maximum number of iterations. - The implementation initializes clusters, calculates initial centroids, and refines the clusters through iterative updates to optimize the cost function based on minimum distance between datapoints and centroids. - Parameters:
- rx – List[float] The x-coordinates of the dataset points to be clustered. 
- ry – List[float] The y-coordinates of the dataset points to be clustered. 
- nc – int The number of clusters to group the data into. 
 
- Returns:
- Clusters
- An instance containing the final cluster assignments and centroids after convergence. 
 
- Raises:
- None –