set S = N \ {P} 在伪代码中意味着什么?
What would set S = N \ {P} mean in pseudocode?
从 Wikipedia 了解 DBscan。文章有以下伪代码:
DBSCAN(DB, distFunc, eps, minPts) {
C = 0 /* Cluster counter */
for each point P in database DB {
if label(P) ≠ undefined then continue /* Previously processed in inner loop */
Neighbors N = RangeQuery(DB, distFunc, P, eps) /* Find neighbors */
if |N| < minPts then { /* Density check */
label(P) = Noise /* Label as Noise */
continue
}
C = C + 1 /* next cluster label */
label(P) = C /* Label initial point */
Seed set S = N \ {P} /* Neighbors to expand */
for each point Q in S { /* Process every seed point */
if label(Q) = Noise then label(Q) = C /* Change Noise to border point */
if label(Q) ≠ undefined then continue /* Previously processed */
label(Q) = C /* Label neighbor */
Neighbors N = RangeQuery(DB, distFunc, Q, eps) /* Find neighbors */
if |N| ≥ minPts then { /* Density check */
S = S ∪ N /* Add new neighbors to seed set */
}
}
}
}
我很确定 |N|将意味着 N.
的计数
行会是什么:
Seed set S = N \ {P} /* Neighbors to expand */
是什么意思?我认为 S 是一个类似于对象列表的种子集。 N\{P}是什么意思?
\
是补运算,所以N \ {P}
是没有点P
的邻居N
的集合。表示P
周围一定距离的所有点,由RangeQuery(DB, distFunc, P, eps)
返回(查询结果包括P
)。
从 Wikipedia 了解 DBscan。文章有以下伪代码:
DBSCAN(DB, distFunc, eps, minPts) {
C = 0 /* Cluster counter */
for each point P in database DB {
if label(P) ≠ undefined then continue /* Previously processed in inner loop */
Neighbors N = RangeQuery(DB, distFunc, P, eps) /* Find neighbors */
if |N| < minPts then { /* Density check */
label(P) = Noise /* Label as Noise */
continue
}
C = C + 1 /* next cluster label */
label(P) = C /* Label initial point */
Seed set S = N \ {P} /* Neighbors to expand */
for each point Q in S { /* Process every seed point */
if label(Q) = Noise then label(Q) = C /* Change Noise to border point */
if label(Q) ≠ undefined then continue /* Previously processed */
label(Q) = C /* Label neighbor */
Neighbors N = RangeQuery(DB, distFunc, Q, eps) /* Find neighbors */
if |N| ≥ minPts then { /* Density check */
S = S ∪ N /* Add new neighbors to seed set */
}
}
}
}
我很确定 |N|将意味着 N.
的计数行会是什么:
Seed set S = N \ {P} /* Neighbors to expand */
是什么意思?我认为 S 是一个类似于对象列表的种子集。 N\{P}是什么意思?
\
是补运算,所以N \ {P}
是没有点P
的邻居N
的集合。表示P
周围一定距离的所有点,由RangeQuery(DB, distFunc, P, eps)
返回(查询结果包括P
)。