Skip to content

Commit b0d2649

Browse files
committed
FIX: pep8 and Py3 support in sklearn.neighbors.base
1 parent 98151cb commit b0d2649

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

sklearn/neighbors/base.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
kd_tree=KDTree.valid_metrics,
2626
# The following list comes from the
2727
# sklearn.metrics.pairwise doc string
28-
brute=(PAIRWISE_DISTANCE_FUNCTIONS.keys() +
28+
brute=(list(PAIRWISE_DISTANCE_FUNCTIONS.keys()) +
2929
['braycurtis', 'canberra', 'chebyshev',
3030
'correlation', 'cosine', 'dice', 'hamming',
3131
'jaccard', 'kulsinski', 'mahalanobis',
@@ -39,9 +39,11 @@
3939
kd_tree=[],
4040
brute=PAIRWISE_DISTANCE_FUNCTIONS.keys())
4141

42+
4243
class NeighborsWarning(UserWarning):
4344
pass
4445

46+
4547
# Make sure that NeighborsWarning are displayed more than once
4648
warnings.simplefilter("always", NeighborsWarning)
4749

@@ -196,9 +198,9 @@ def _fit(self, X):
196198
# A tree approach is better for small number of neighbors,
197199
# and KDTree is generally faster when available
198200
if (self.n_neighbors is None
199-
or self.n_neighbors < self._fit_X.shape[0] // 2):
201+
or self.n_neighbors < self._fit_X.shape[0] // 2):
200202
if (callable(self.effective_metric_)
201-
or self.effective_metric_ in VALID_METRICS['kd_tree']):
203+
or self.effective_metric_ in VALID_METRICS['kd_tree']):
202204
self._fit_method = 'kd_tree'
203205
else:
204206
self._fit_method = 'ball_tree'

0 commit comments

Comments
 (0)