DBSCAN(D, eps, MinPts)
C = 0
for each unvisited point P in dataset D
mark P as visited
NeighborPts = regionQuery(P, eps)
if sizeof(NeighborPts) < MinPts
mark P as NOI
我試圖通過scikit-learn瞭解DBSCAN實現,但我遇到了麻煩。這是我的數據樣本: X = [[0,0],[0,1],[1,1],[1,2],[2,2],[5,0],[5,1],[5,2],[8,0],[10,0]]
然後我計算d如在提供 D = distance.squareform(distance.pdist(X))
D返回與每個點和所有其他之間的距離的矩陣的例子。對角線因此