AttributeError: 'Simple_Imputer' object has no attribute 'fill_value_categorical'' in PyCaret

Viewed 3367

I am using PyCaret and get an error.

AttributeError: 'Simple_Imputer' object has no attribute 'fill_value_categorical'

Trying to create a basic instance.

!pip install pycaret==1.0

from pycaret.regression import *
exp_reg = setup(data=df, target='Survived', session_id=2)
4 Answers

i reinstaled pycraret (!pip install pycaret) and it worked; no clue what happened.

@eddygeek's answer is correct. I faced the same error, and forcing the installation of scikit-learn 0.23.2 did the trick.

pip install scikit-learn==0.23.2 --force-reinstall

I encountered this error when I installed pycaret without its dependencies.

The following would cause this error:

!pip install imblearn --no-deps pycaret scikit-plot pyod lightgbm plotly

To avoid this error, change to:

!pip install pycaret
  • pycaret <= 2.3.5 requires sklearn == 0.23.2
  • now pycaret has added a check in setup to fail early if sklearn version is wrong.
  • issue of OP is because sklearn (presumably 0.24.x) introduced a new way to introspect BaseEstimator objects based on __init__ signature (see _get_param_names), which requires than any __init__ param has a corresponding class attribute of the same name. pycaret subclasses like Simple_Imputer currently does not conform to this expectation
Related