-
Notifications
You must be signed in to change notification settings - Fork 87
Deprecated attributes argument on check_is_fitted() #133
Copy link
Copy link
Closed
Labels
bugReport a problem that needs to be fixedReport a problem that needs to be fixed
Description
Description of the problem
When using an EQLHarmonic object to predict some data, sklearn is raising a FutureWarning because the attributes argument on sklearn.utils.validation.check_is_fitted is currently ignored (for sklearn == 0.22) and will be deprecated (on sklearn == 0.23). The function now checks if the predictor has any attribute that ends with a trailing underscore.
Possible Solution
We would just need to remove the attributes list passed to check_is_fitted function on the EQLHarmonic.predict method.
| check_is_fitted(self, ["coefs_"]) |
Full code that generated the error
python examples/eql/harmonic.py Full error message
Number of data points: 7054
Mean height of observations: 541.8293166997448
/home/santi/.miniconda3/envs/harmonica/lib/python3.7/site-packages/sklearn/utils/validation.py:933: FutureWarning: Passing attributes to check_is_fitted is deprecated and will be removed in 0.23. The attributes argument is ignored.
"argument is ignored.", FutureWarning)
R² score: 0.9988789670714463
/home/santi/.miniconda3/envs/harmonica/lib/python3.7/site-packages/sklearn/utils/validation.py:933: FutureWarning: Passing attributes to check_is_fitted is deprecated and will be removed in 0.23. The attributes argument is ignored.
"argument is ignored.", FutureWarning)
Generated grid:
<xarray.Dataset>
Dimensions: (easting: 95, northing: 157)
Coordinates:
* easting (easting) float64 -3.24e+05 -3.235e+05 ... -2.769e+05
* northing (northing) float64 4.175e+06 4.176e+06 ... 4.253e+06
Data variables:
magnetic_anomaly (northing, easting) float64 30.67 30.73 ... 161.3 149.9
Attributes:
metadata: Generated by EQLHarmonic(damping=1, points=None, relative_dept...
System information
- Operating system: Manjaro Linux XFCE
- Python installation (Anaconda, system, ETS): Anaconda
- Version of Python: 3.7.3
- Version of this package: f2878be
- If using conda, paste the output of
conda listbelow:
output of conda list
# packages in environment at /home/santi/.miniconda3/envs/harmonica: # # Name Version Build Channel _libgcc_mutex 0.1 main conda-forge alabaster 0.7.12 py_0 conda-forge appdirs 1.4.3 py_1 conda-forge astroid 2.3.3 py37_0 conda-forge attrs 19.3.0 py_0 conda-forge babel 2.7.0 py_0 conda-forge black 19.10b0 py37_0 conda-forge bzip2 1.0.8 h516909a_2 conda-forge ca-certificates 2019.11.28 hecc5488_0 conda-forge cartopy 0.17.0 py37h423102d_1009 conda-forge certifi 2019.11.28 py37_0 conda-forge cffi 1.13.2 py37h8022711_0 conda-forge chardet 3.0.4 py37_1003 conda-forge click 7.0 py_0 conda-forge coverage 4.5.4 py37h516909a_0 conda-forge cryptography 2.8 py37h72c5cf5_1 conda-forge cycler 0.10.0 py_2 conda-forge dbus 1.13.6 he372182_0 conda-forge docutils 0.15.2 py37_0 conda-forge entrypoints 0.3 py37_1000 conda-forge expat 2.2.5 he1b5a44_1004 conda-forge flake8 3.7.9 py37_0 conda-forge fontconfig 2.13.1 h86ecdb6_1001 conda-forge freetype 2.10.0 he983fc9_1 conda-forge geos 3.8.0 he1b5a44_0 conda-forge gettext 0.19.8.1 hc5be6a0_1002 conda-forge glib 2.58.3 py37h6f030ca_1002 conda-forge gst-plugins-base 1.14.5 h0935bb2_0 conda-forge gstreamer 1.14.5 h36ae1b5_0 conda-forge harmonica 0.1.0a1+112.g77b0658 dev_0 icu 64.2 he1b5a44_1 conda-forge idna 2.8 py37_1000 conda-forge imagesize 1.1.0 py_0 conda-forge importlib_metadata 1.2.0 py37_0 conda-forge isort 4.3.21 py37_0 conda-forge jinja2 2.10.3 py_0 conda-forge joblib 0.14.0 py_0 conda-forge jpeg 9c h14c3975_1001 conda-forge kiwisolver 1.1.0 py37hc9558a2_0 conda-forge lazy-object-proxy 1.4.3 py37h516909a_0 conda-forge ld_impl_linux-64 2.33.1 h53a641e_7 conda-forge libblas 3.8.0 14_openblas conda-forge libcblas 3.8.0 14_openblas conda-forge libclang 9.0.0 default_hde54327_4 conda-forge libffi 3.2.1 he1b5a44_1006 conda-forge libgcc-ng 9.2.0 hdf63c60_0 conda-forge libgfortran-ng 7.3.0 hdf63c60_2 conda-forge libiconv 1.15 h516909a_1005 conda-forge liblapack 3.8.0 14_openblas conda-forge libllvm8 8.0.1 hc9558a2_0 conda-forge libllvm9 9.0.0 hc9558a2_3 conda-forge libopenblas 0.3.7 h5ec1e0e_5 conda-forge libpng 1.6.37 hed695b0_0 conda-forge libstdcxx-ng 9.2.0 hdf63c60_0 conda-forge libtiff 4.1.0 hc3755c2_1 conda-forge libuuid 2.32.1 h14c3975_1000 conda-forge libxcb 1.13 h14c3975_1002 conda-forge libxkbcommon 0.9.1 hebb1f50_0 conda-forge libxml2 2.9.10 hee79883_0 conda-forge llvmlite 0.30.0 py37h8b12597_1 conda-forge lz4-c 1.8.3 he1b5a44_1001 conda-forge markupsafe 1.1.1 py37h516909a_0 conda-forge matplotlib 3.1.2 py37_1 conda-forge matplotlib-base 3.1.2 py37h250f245_1 conda-forge mccabe 0.6.1 py_1 conda-forge more-itertools 8.0.2 py_0 conda-forge mypy_extensions 0.4.3 py37_0 conda-forge ncurses 6.1 hf484d3e_1002 conda-forge nspr 4.24 he1b5a44_0 conda-forge nss 3.47 he751ad9_0 conda-forge numba 0.46.0 py37hb3f55d8_1 conda-forge numpy 1.17.3 py37h95a1406_0 conda-forge numpydoc 0.9.1 py_0 conda-forge olefile 0.46 py_0 conda-forge openssl 1.1.1d h516909a_0 conda-forge owslib 0.19.0 py_1 conda-forge packaging 19.2 py_0 conda-forge pandas 0.25.3 py37hb3f55d8_0 conda-forge pathspec 0.6.0 py_0 conda-forge pcre 8.43 he1b5a44_0 conda-forge pillow 6.2.1 py37hd70f55b_1 conda-forge pip 19.3.1 py37_0 conda-forge pluggy 0.13.0 py37_0 conda-forge pooch 0.7.0 py_0 conda-forge proj 6.2.1 hc80f0dc_0 conda-forge pthread-stubs 0.4 h14c3975_1001 conda-forge py 1.8.0 py_0 conda-forge pycodestyle 2.5.0 py_0 conda-forge pycparser 2.19 py37_1 conda-forge pyepsg 0.4.0 py_0 conda-forge pyflakes 2.1.1 py_0 conda-forge pygments 2.5.2 py_0 conda-forge pykdtree 1.3.1 py37hc1659b7_1002 conda-forge pylint 2.4.4 py37_0 conda-forge pyopenssl 19.1.0 py37_0 conda-forge pyparsing 2.4.5 py_0 conda-forge pyproj 2.4.2.post1 py37h12732c1_0 conda-forge pyqt 5.12.3 py37hcca6a23_1 conda-forge pyqt5-sip 4.19.18 pypi_0 pypi pyqtwebengine 5.12.1 pypi_0 pypi pyshp 2.1.0 py_0 conda-forge pysocks 1.7.1 py37_0 conda-forge pytest 5.3.1 py37_0 conda-forge pytest-cov 2.8.1 py_0 conda-forge python 3.7.3 h357f687_2 conda-forge python-dateutil 2.8.1 py_0 conda-forge pytz 2019.3 py_0 conda-forge qt 5.12.5 hd8c4c69_1 conda-forge readline 8.0 hf8c457e_0 conda-forge regex 2019.12.9 py37h516909a_0 conda-forge requests 2.22.0 py37_1 conda-forge scikit-learn 0.22 py37hcdab131_1 conda-forge scipy 1.3.2 py37h921218d_0 conda-forge setuptools 42.0.2 py37_0 conda-forge shapely 1.6.4 py37h5d51c17_1007 conda-forge six 1.13.0 py37_0 conda-forge snowballstemmer 2.0.0 py_0 conda-forge sphinx 2.2.1 py_0 conda-forge sphinx-gallery 0.5.0 py_0 conda-forge sphinx_rtd_theme 0.4.3 py_0 conda-forge sphinxcontrib-applehelp 1.0.1 py_0 conda-forge sphinxcontrib-devhelp 1.0.1 py_0 conda-forge sphinxcontrib-htmlhelp 1.0.2 py_0 conda-forge sphinxcontrib-jsmath 1.0.1 py_0 conda-forge sphinxcontrib-qthelp 1.0.2 py_0 conda-forge sphinxcontrib-serializinghtml 1.1.3 py_0 conda-forge sqlite 3.30.1 hcee41ef_0 conda-forge tk 8.6.10 hed695b0_0 conda-forge toml 0.10.0 py_0 conda-forge tornado 6.0.3 py37h516909a_0 conda-forge typed-ast 1.4.0 py37h516909a_0 conda-forge typing_extensions 3.7.4.1 py37_0 conda-forge urllib3 1.25.7 py37_0 conda-forge verde 1.2.0+1.g20c906b.dirty pypi_0 pypi wcwidth 0.1.7 py_1 conda-forge wheel 0.33.6 py37_0 conda-forge wrapt 1.11.2 py37h516909a_0 conda-forge xarray 0.14.1 py_0 conda-forge xorg-libxau 1.0.9 h14c3975_0 conda-forge xorg-libxdmcp 1.1.3 h516909a_0 conda-forge xz 5.2.4 h14c3975_1001 conda-forge zipp 0.6.0 py_0 conda-forge zlib 1.2.11 h516909a_1006 conda-forge zstd 1.4.4 h3b9ef0a_1 conda-forge
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugReport a problem that needs to be fixedReport a problem that needs to be fixed