Last active
January 12, 2021 04:42
-
-
Save ForteXX-2020/3a25846cc40488df9721209c717c91d6 to your computer and use it in GitHub Desktop.
0001_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 pylab import plt, mpl | |
from sklearn.cluster import KMeans | |
from sklearn.datasets import make_blobs | |
x, y = make_blobs(n_samples=200, centers=5, | |
random_state=500, cluster_std=1.25) | |
model = KMeans(n_clusters=5, random_state=0) | |
model.fit(x) | |
KMeans(n_clusters=5, random_state=0) | |
y_ = model.predict(x) | |
plt.figure(figsize=(10, 6)) | |
plt.scatter(x[:, 0], x[:, 1], c=y_, cmap='coolwarm'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment