Description
Running prediction methods without running fit should raise NotFittedError. This is not the case for some non-standard methods.
check_is_fitted should be applied for this purpose.
Steps/Code to Reproduce
from sklearn.neighbors import NearestNeighbors
NearestNeighbors().kneighbors_graph([[1]])
or
from sklearn.neighbors import NearestNeighbors
NearestNeighbors().radius_neighbors_graph([[1]])
Expected Results
NotFittedError raised
Actual Results
AttributeError raised
Versions
System
------
python: 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:52:12) [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)]
executable: /Users/joel/anaconda3/envs/scipy3k/bin/python
machine: Darwin-17.7.0-x86_64-i386-64bit
BLAS
----
lib_dirs: /Users/joel/anaconda3/envs/scipy3k/lib
macros: SCIPY_MKL_H=None, HAVE_CBLAS=None
cblas_libs: mkl_rt, pthread
Python deps
-----------
setuptools: 37.0.0
scipy: 1.0.0
pip: 18.0
numpy: 1.14.1
sklearn: 0.21.dev0
pandas: 0.23.4
Cython: 0.28.5
Description
Running prediction methods without running
fitshould raiseNotFittedError. This is not the case for some non-standard methods.check_is_fittedshould be applied for this purpose.Steps/Code to Reproduce
or
Expected Results
NotFittedError raised
Actual Results
AttributeError raised
Versions