FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Python/cluster.py at main · melophilecode/Python · GitHub
melophilecode
/
Python
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Python
/
cluster.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
9 lines (9 loc) · 305 Bytes
Breadcrumbs
Python
/
cluster.py
Copy path
File metadata and controls
9 lines (9 loc) · 305 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
from
sklearn
.
datasets
import
make_blobs
from
sklearn
.
cluster
import
KMeans
import
matplotlib
.
pyplot
as
plt
X
,
y
=
make_blobs
(
n_samples
=
100
,
centers
=
4
,
random_state
=
42
)
km
=
KMeans
(
n_clusters
=
4
,
random_state
=
42
)
km
.
fit
(
X
)
plt
.
scatter
(
X
[:,
0
],
X
[:,
1
],
c
=
km
.
labels_
)
plt
.
title
(
"K_Means Clustering"
)
plt
.
show
()
Back
|
FazBrowse Home
|
New Git URL