Created
June 1, 2021 05:32
-
-
Save Lakshmi-1212/a2176245235fee2e70f0f5015838797c to your computer and use it in GitHub Desktop.
Apply the k-means algorithm
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=5, 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