Get groups using kmeans#
- shift.get_kmeans_clusters(num_cluster: int, points: list[GeoLocation]) list[GroupModel] #
Function to return kmeans clusters for given set of points.
- Parameters:
num_cluster (int) – Number of cluster to group given set of points.
points (list[GeoLocation]) – List of points for clustering.
- Returns:
Generated cluster.
- Return type:
list[ClusterModel]
Examples
>>> from shift.cluster import get_kmeans_clusters >>> points = [GeoLocation(2, 3), GeoLocation(3, 4), GeoLocation(4, 5)] >>> clusters = get_kmeans_clusters(2, points)