Last active
July 2, 2022 09:08
-
-
Save Bennykillua/f2328a2e2be0c33445cb72dac05bb3ae to your computer and use it in GitHub Desktop.
Sklearn Open Source
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 import cluster, datasets | |
# load data | |
iris = datasets.load_iris() | |
# K-means clustering: create clusters for k=3 | |
k=3 | |
k_means = cluster.KMeans(k) | |
# fit data | |
k_means.fit(iris.data) | |
# print results | |
print( k_means.labels_[::10]) | |
print( iris.target[::10]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment