Skip to content

Instantly share code, notes, and snippets.

@ozgurozkok
Created March 24, 2023 22:05
Show Gist options
  • Save ozgurozkok/8b3116560197d52d22a5d73a3a7376c2 to your computer and use it in GitHub Desktop.
Save ozgurozkok/8b3116560197d52d22a5d73a3a7376c2 to your computer and use it in GitHub Desktop.
clustering with dbscan
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