8000 Partly revert #6799 to keep DBSCAN fast (#9118) · plagree/scikit-learn@c393bd4 · GitHub
[go: up one dir, main page]

Skip to content

Commit c393bd4

Browse files
qinhanmin2014ogrisel
authored andcommitted
Partly revert scikit-learn#6799 to keep DBSCAN fast (scikit-learn#9118)
1 parent 7ee4dc8 commit c393bd4

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

sklearn/cluster/_dbscan_inner.pyx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
44

55
cimport cython
66
from libcpp.vector cimport vector
7-
from libcpp.set cimport set as cset
87
cimport numpy as np
98
import numpy as np
109

@@ -23,7 +22,6 @@ def dbscan_inner(np.ndarray[np.uint8_t, ndim=1, mode='c'] is_core,
2322
cdef np.npy_intp i, label_num = 0, v
2423
cdef np.ndarray[np.npy_intp, ndim=1] neighb
2524
cdef vector[np.npy_intp] stack
26-
cdef cset[np.npy_intp] seen
2725

2826
for i in range(labels.shape[0]):
2927
if labels[i] != -1 or not is_core[i]:
@@ -40,15 +38,12 @@ def dbscan_inner(np.ndarray[np.uint8_t, ndim=1, mode='c'] is_core,
4038
neighb = neighborhoods[i]
4139
for i in range(neighb.shape[0]):
4240
v = neighb[i]
43-
if labels[v] == -1 and seen.count(v) == 0:
44-
seen.insert(v)
41+
if labels[v] == -1:
4542
push(stack, v)
4643

4744
if stack.size() == 0:
4845
break
4946
i = stack.back()
5047
stack.pop_back()
5148

52-
seen.clear()
53-
5449
label_num += 1

0 commit comments

Comments
 (0)
0