File tree 2 files changed +9
-5
lines changed 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 14
14
from .kde import KernelDensity
15
15
from .approximate import LSHForest
16
16
from .lof import LocalOutlierFactor
17
- from .base import VALID_METRICS
17
+ from .base import VALID_METRICS , VALID_METRICS_SPARSE
18
18
19
19
__all__ = ['BallTree' ,
20
20
'DistanceMetric' ,
30
30
'KernelDensity' ,
31
31
'LSHForest' ,
32
32
'LocalOutlierFactor' ,
33
- 'VALID_METRICS' ]
33
+ 'VALID_METRICS' ,
34
+ 'VALID_METRICS_SPARSE' ]
Original file line number Diff line number Diff line change @@ -217,9 +217,12 @@ def _fit(self, X):
217
217
"using brute force" )
218
218
if self .effective_metric_ not in VALID_METRICS_SPARSE ['brute' ] \
219
219
and not callable (self .effective_metric_ ):
220
-
221
- raise ValueError ("metric '%s' not valid for sparse input"
222
- % self .effective_metric_ )
220
+ raise ValueError ("Metric '%s' not valid for sparse input. "
221
+ "Use sorted(sklearn.neighbors."
222
+ "VALID_METRICS_SPARSE['brute']) "
223
+ "to get valid options. "
224
+ "Metric can also be a callable function."
225
+ % (self .effective_metric_ ))
223
226
self ._fit_X = X .copy ()
224
227
self ._tree = None
225
228
self ._fit_method = 'brute'
You can’t perform that action at this time.
0 commit comments