Created
March 6, 2020 14:19
-
-
Save jinglescode/875bc783890e89236d445f74bf8ab696 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# KMeans | |
from sklearn.cluster import KMeans | |
kmeans = KMeans(n_clusters=int(num_days), random_state=0).fit(places_lat_long) | |
group = list(kmeans.labels_) | |
# MeanShift | |
from sklearn.cluster import MeanShift, estimate_bandwidth | |
bandwidth = estimate_bandwidth(places_lat_long, quantile=0.2) | |
clustering = MeanShift(bandwidth=bandwidth).fit(places_lat_long) | |
group = clustering.labels_ | |
# SpectralClustering | |
from sklearn.cluster import SpectralClustering | |
clustering = SpectralClustering(n_clusters=9, | |
assign_labels="discretize", | |
random_state=0).fit(places_lat_long) | |
group = clustering.labels_ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
good job!