8000 BUG allow outlier_label=0 in RadiusNeighborClassifier · InterferencePattern/scikit-learn@5a2b047 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5a2b047

Browse files
Bastiaan van den Bergamueller
authored andcommitted
BUG allow outlier_label=0 in RadiusNeighborClassifier
Fixes scikit-learn#1602.
1 parent 
8000
9ae3094 commit 5a2b047

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sklearn/neighbors/classification.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def predict(self, X):
284284
neigh_dist, neigh_ind = self.radius_neighbors(X)
285285
pred_labels = [self._y[ind] for ind in neigh_ind]
286286

287-
if self.outlier_label:
287+
if self.outlier_label is not None:
288288
outlier_label = np.array((self.outlier_label, ))
289289
small_value = np.array((1e-6, ))
290290
for i, pl in enumerate(pred_labels):
@@ -315,7 +315,7 @@ def predict(self, X):
315315
mode = mode.flatten().astype(np.int)
316316
# map indices to classes
317317
prediction = self.classes_.take(mode)
318-
if self.outlier_label:
318+
if self.outlier_label is not None:
319319
# reset outlier label
320320
prediction[mode == outlier_label] = self.outlier_label
321321
return prediction

0 commit comments

Comments
 (0)
0