Created
March 24, 2023 22:05
-
-
Save ozgurozkok/8b3116560197d52d22a5d73a3a7376c2 to your computer and use it in GitHub Desktop.
clustering with dbscan
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 DBSCAN | |
from sklearn.datasets import make_blobs | |
# Generate sample data | |
X, y = make_blobs(n_samples=1000, centers=3, random_state=42) | |
# Perform clustering | |
dbscan = DBSCAN(eps=0.5, min_samples=5) | |
dbscan.fit(X) | |
# Print cluster labels | |
print(dbscan.labels_) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment