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

scikit-learn version issue #446

Open
Ezzaldin97 opened this issue Feb 15, 2024 · 2 comments
Open

scikit-learn version issue #446

Ezzaldin97 opened this issue Feb 15, 2024 · 2 comments

Comments

@Ezzaldin97
Copy link

Description:
There is an issue with OneHotEncoder, as it isn't accepting argument 'sparse'

explanation:
recent versions of OneHotEncoder Object changed the 'sparse' argument to 'sparse_output', so this error is because of the issue in the dependencies version.

solution:
this can be solved either by limiting the versions of the dependencies or handling the code to match the recent versions.

issue:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[2], [line 1](vscode-notebook-cell:?execution_count=2&line=1)
----> [1](vscode-notebook-cell:?execution_count=2&line=1) from lazypredict.Supervised import LazyRegressor

File [d:\lazypredict\lazypredict\Supervised.py:98](file:///D:/lazypredict/lazypredict/Supervised.py:98)
     [89](file:///D:/lazypredict/lazypredict/Supervised.py:89) # CLASSIFIERS.append(('CatBoostClassifier',catboost.CatBoostClassifier))
     [91](file:///D:/lazypredict/lazypredict/Supervised.py:91) numeric_transformer = Pipeline(
     [92](file:///D:/lazypredict/lazypredict/Supervised.py:92)     steps=[("imputer", SimpleImputer(strategy="mean")), ("scaler", StandardScaler())]
     [93](file:///D:/lazypredict/lazypredict/Supervised.py:93) )
     [95](file:///D:/lazypredict/lazypredict/Supervised.py:95) categorical_transformer_low = Pipeline(
     [96](file:///D:/lazypredict/lazypredict/Supervised.py:96)     steps=[
     [97](file:///D:/lazypredict/lazypredict/Supervised.py:97)         ("imputer", SimpleImputer(strategy="constant", fill_value="missing")),
---> [98](file:///D:/lazypredict/lazypredict/Supervised.py:98)         ("encoding", OneHotEncoder(handle_unknown="ignore", sparse=False)),
     [99](file:///D:/lazypredict/lazypredict/Supervised.py:99)     ]
    [100](file:///D:/lazypredict/lazypredict/Supervised.py:100) )
    [102](file:///D:/lazypredict/lazypredict/Supervised.py:102) categorical_transformer_high = Pipeline(
    [103](file:///D:/lazypredict/lazypredict/Supervised.py:103)     steps=[
    [104](file:///D:/lazypredict/lazypredict/Supervised.py:104)         ("imputer", SimpleImputer(strategy="constant", fill_value="missing")),
   (...)
    [107](file:///D:/lazypredict/lazypredict/Supervised.py:107)     ]
    [108](file:///D:/lazypredict/lazypredict/Supervised.py:108) )
    [111](file:///D:/lazypredict/lazypredict/Supervised.py:111) # Helper function

TypeError: OneHotEncoder.__init__() got an unexpected keyword argument 'sparse'
@nityansuman
Copy link

Fixed here: https://github.com/nityansuman/lazypredict-nightly (PYPI: pip install lazypredict-nightly) @Ezzaldin97

@Ezzaldin97
Copy link
Author

Thanks @nityansuman 🙏

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