5

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)
guilherme guerra
  • 161
  • 1
  • 2
  • 5
  • Does it help https://stackoverflow.com/q/65012601#answers ? – azro May 24 '21 at 20:27
  • 1
    Does this answer your question? [AttributeError: 'SimpleImputer' object has no attribute '\_validate\_data' in PyCaret](https://stackoverflow.com/questions/65012601/attributeerror-simpleimputer-object-has-no-attribute-validate-data-in-pyca) – Sven Eberth May 24 '21 at 20:29

4 Answers4

2

@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
jlcC84g
  • 86
  • 5
1

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

desertnaut
  • 57,590
  • 26
  • 140
  • 166
guilherme guerra
  • 161
  • 1
  • 2
  • 5
0

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
Sayyor Y
  • 1,130
  • 2
  • 14
  • 27
0
  • 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
eddygeek
  • 4,236
  • 3
  • 25
  • 32