diff --git a/scikits/learn/neighbors.py b/scikits/learn/neighbors.py index 6fa37f2017826c322d6435cccba8ef8b4d0cd50d..2083ecdce1aed51afab3e142032a45ec9e543310 100644 --- a/scikits/learn/neighbors.py +++ b/scikits/learn/neighbors.py @@ -23,11 +23,10 @@ class NeighborsClassifier(BaseEstimator, ClassifierMixin): window_size : int, optional Window size passed to BallTree - algorithm : {'auto', 'ball_tree', 'brute', 'brute_inplace'}, optional - Algorithm used to compute the nearest neighbors. 'ball_tree' - will construct a BallTree, 'brute' and 'brute_inplace' will - perform brute-force search.'auto' will guess the most - appropriate based on current dataset. + algorithm : {'auto', 'ball_tree', 'brute'}, optional + Algorithm used to compute the nearest neighbors. 'ball_tree' will + construct a BallTree while 'brute'will perform brute-force + search. 'auto' will guess the most appropriate based on current dataset. Examples -------- @@ -136,12 +135,9 @@ class NeighborsClassifier(BaseEstimator, ClassifierMixin): self._set_params(**params) X = np.atleast_2d(X) if self.ball_tree is None: - if self.algorithm == 'brute_inplace' and not return_distance: - return knn_brute(self._fit_X, X, self.n_neighbors) - else: - dist = euclidean_distances(X, self._fit_X, squared=True) - # XXX: should be implemented with a partial sort - neigh_ind = dist.argsort(axis=1)[:, :self.n_neighbors] + dist = euclidean_distances(X, self._fit_X, squared=True) + # XXX: should be implemented with a partial sort + neigh_ind = dist.argsort(axis=1)[:, :self.n_neighbors] if not return_distance: return neigh_ind else: @@ -205,11 +201,11 @@ class NeighborsRegressor(NeighborsClassifier, RegressorMixin): mode : {'mean', 'barycenter'}, optional Weights to apply to labels. - algorithm : {'auto', 'ball_tree', 'brute', 'brute_inplace'}, optional - Algorithm used to compute the nearest neighbors. 'ball_tree' - will construct a BallTree, 'brute' and 'brute_inplace' will - perform brute-force search.'auto' will guess the most - appropriate based on current dataset. + algorithm : {'auto', 'ball_tree', 'brute'}, optional + Algorithm used to compute the nearest neighbors. 'ball_tree' will + construct a BallTree, while 'brute' will perform brute-force + search. 'auto' will guess the most appropriate based on current + dataset. Examples --------