Closed ftuzzolino closed 1 month ago
This is the same as issue #441
The keyword changed from sparse
to sparse_output
Thank you very much! It works
How do I import LazyClassifier / LazyRegressor without triggering this error?
I know that OHE parameter name was changed from sparse
to sparse_output
in later versions. But shouldn't this be fixed in LazyRegressor code? I mean it's lazypredict that tries to call parameter by its old name
Update Supervised.py
facing the same issue while after installing lazypredict==0.2.12 and LazyClassifier from the library. how to change the parameter from sparse to sparse_output ?
Ok, last comment gave me a hint – you just go to your "site-packages" folder e.g. C:\Users\Me.conda\envs\environment_name\Lib\site-packages\lazypredict , manually open Supervised.py, ctrl+f "sparse" & paste "sparse_output" instead & save it
Fixed here: https://github.com/nityansuman/lazypredict-nightly (PYPI: pip install lazypredict-nightly) @LurkSkywalker @tanwarsh @ftuzzolino @JSchoeck
@JSchoeck @LurkSkywalker @tanwarsh until #444 gets approved and merged, the temporary solution is to use scikit-learn<1.4
from lazypredict.Supervised import LazyClassifier
TypeError Traceback (most recent call last) Cell In[1], line 26 24 from shap.plots import waterfall 25 from matplotlib import pyplot ---> 26 from lazypredict.Supervised import LazyClassifier
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\lazypredict\Supervised.py:98 89 # CLASSIFIERS.append(('CatBoostClassifier',catboost.CatBoostClassifier)) 91 numeric_transformer = Pipeline( 92 steps=[("imputer", SimpleImputer(strategy="mean")), ("scaler", StandardScaler())] 93 ) 95 categorical_transformer_low = Pipeline( 96 steps=[ 97 ("imputer", SimpleImputer(strategy="constant", fill_value="missing")), ---> 98 ("encoding", OneHotEncoder(handle_unknown="ignore", sparse=False)), 99 ] 100 ) 102 categorical_transformer_high = Pipeline( 103 steps=[ 104 ("imputer", SimpleImputer(strategy="constant", fill_value="missing")), (...) 107 ] 108 ) 111 # Helper function
TypeError: OneHotEncoder.init() got an unexpected keyword argument 'sparse'
python 3.11.5 Package Version
alabaster 0.7.16 anyio 4.2.0 argon2-cffi 23.1.0 argon2-cffi-bindings 21.2.0 arrow 1.3.0 asttokens 2.4.1 async-lru 2.0.4 attrs 23.2.0 Babel 2.14.0 beautifulsoup4 4.12.3 bleach 6.1.0 certifi 2023.11.17 cffi 1.16.0 charset-normalizer 3.3.2 click 8.1.7 click-plugins 1.1.1 cligj 0.7.2 cloudpickle 3.0.0 colorama 0.4.6 comm 0.2.1 contourpy 1.2.0 cycler 0.12.1 debugpy 1.8.0 decorator 5.1.1 defusedxml 0.7.1 docutils 0.20.1 et-xmlfile 1.1.0 executing 2.0.1 fastjsonschema 2.19.1 fiona 1.9.5 fonttools 4.47.2 fqdn 1.5.1 geopandas 0.14.2 idna 3.6 imagesize 1.4.1 iniconfig 2.0.0 ipykernel 6.29.0 ipython 8.20.0 ipywidgets 8.1.1 isoduration 20.11.0 jedi 0.19.1 Jinja2 3.1.3 joblib 1.3.2 json5 0.9.14 jsonpointer 2.4 jsonschema 4.21.1 jsonschema-specifications 2023.12.1 jupyter_client 8.6.0 jupyter_core 5.7.1 jupyter-events 0.9.0 jupyter-lsp 2.2.2 jupyter_server 2.12.5 jupyter_server_terminals 0.5.2 jupyterlab 4.0.11 jupyterlab_pygments 0.3.0 jupyterlab_server 2.25.2 jupyterlab-widgets 3.0.9 kiwisolver 1.4.5 lazypredict 0.2.12 lightgbm 4.3.0 llvmlite 0.41.1 markdown-it-py 3.0.0 MarkupSafe 2.1.4 matplotlib 3.8.2 matplotlib-inline 0.1.6 mdit-py-plugins 0.4.0 mdurl 0.1.2 mistune 3.0.2 myst-parser 2.0.0 nbclient 0.9.0 nbconvert 7.14.2 nbformat 5.9.2 nest-asyncio 1.6.0 notebook 7.0.7 notebook_shim 0.2.3 numba 0.58.1 numpy 1.26.3 openpyxl 3.1.2 overrides 7.7.0 packaging 23.2 pandas 2.2.0 pandas-compat 0.1.1 pandoc 2.3 pandocfilters 1.5.1 parso 0.8.3 pillow 10.2.0 pip 23.3.2 platformdirs 4.1.0 pluggy 1.4.0 plumbum 1.8.2 ply 3.11 prometheus-client 0.19.0 prompt-toolkit 3.0.43 psutil 5.9.8 pure-eval 0.2.2 pyarrow 15.0.0 pycparser 2.21 Pygments 2.17.2 pyparsing 3.1.1 pyproj 3.6.1 pyshp 2.3.1 pytest 8.0.0 python-dateutil 2.8.2 python-json-logger 2.0.7 pytz 2023.4 pywin32 306 pywinpty 2.0.12 PyYAML 6.0.1 pyzmq 25.1.2 referencing 0.33.0 requests 2.31.0 rfc3339-validator 0.1.4 rfc3986-validator 0.1.1 rpds-py 0.17.1 scikit-learn 1.4.0 scipy 1.12.0 seaborn 0.13.2 Send2Trash 1.8.2 setuptools 65.5.0 shap 0.44.1 shapely 2.0.2 six 1.16.0 slicer 0.0.7 sniffio 1.3.0 snowballstemmer 2.2.0 soupsieve 2.5 Sphinx 7.2.6 sphinxcontrib-applehelp 1.0.8 sphinxcontrib-devhelp 1.0.6 sphinxcontrib-htmlhelp 2.0.5 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.7 sphinxcontrib-serializinghtml 1.1.10 stack-data 0.6.3 terminado 0.18.0 threadpoolctl 3.2.0 tinycss2 1.2.1 tornado 6.4 tqdm 4.66.1 traitlets 5.14.1 types-python-dateutil 2.8.19.20240106 tzdata 2023.4 uri-template 1.3.0 urllib3 2.1.0 wcwidth 0.2.13 webcolors 1.13 webencodings 0.5.1 websocket-client 1.7.0 wheel 0.42.0 widgetsnbextension 4.0.9 xgboost 2.0.3