from sklearn.cluster import DBSCAN
from sklearn.datasets import make_blobs
import matplotlib.pyplot as plt
import mglearn
X,y=make_blobs(random_state=0,n_samples=12)
dbscan=DBSCAN()
clusters=dbscan.fit_predict(X)
# 都被标记为噪声
print('Cluster memberships:\n{}'.format(clusters))
mglearn.plots.plot_dbscan()
plt.show()
def __init__(self, eps=0.5, min_samples=5, metric='euclidean',
metric_params=None, algorithm='auto', leaf_size=30, p=None,
n_jobs=1):
参考链接:
[1] DBSCAN 算法 2019.1