Last active
June 2, 2021 04:52
-
-
Save Lakshmi-1212/0418c134dfb539f7001c812c58273a96 to your computer and use it in GitHub Desktop.
K-Means Clustering
This file contains 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
from sklearn.cluster import KMeans | |
# Create the KMeans object for 5 clusters and 50 iterations | |
kmeans = KMeans(n_clusters=4, max_iter=50) | |
# Fit the k-means algorithm on the given scaled players data | |
kmeans.fit(players_scaled) | |
# Assign the label to the output column in the original players | |
players["cluster_kmeans"] = kmeans.labels_ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment