Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OneHotEncoder.__init__() got an unexpected keyword argument 'sparse #454

Open
minivillalba4 opened this issue Aug 1, 2024 · 1 comment

Comments

@minivillalba4
Copy link

When I execute this line of code on Jupiter Notebook this is what happens:

from lazypredict.Supervised import LazyClassifier


TypeError Traceback (most recent call last)
Cell In[1], line 6
4 import matplotlib.pyplot as plt
5 from sklearn.model_selection import train_test_split,RandomizedSearchCV
----> 6 from lazypredict.Supervised import LazyClassifier
7 from sklearn.preprocessing import MinMaxScaler

File ~\anaconda3\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'

@balachandragv
Copy link

Hi.. Changing 'sparse' to 'sparse_output' will resolve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants