6

I am trying to create a model using pycaret just as:

from pycaret.classification import *

clf1 = setup(data = dt, target = 'group')
lr = create_model('lr')

Then I get:

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

So, following here, I added:

clf1 = setup(data = dt, target = 'group',  imputation_type='iterative' )
lr = create_model('lr')

Then I get:

AttributeError: 'Make_Time_Features' object has no attribute 'list_of_features'

My version of sklearn is 0.23.2 and pycaret is 2.3.2

Gustavomoty
  • 87
  • 1
  • 5
  • Please add the specifics of your dataset (shape, data types, missing values, etc.) and preferably a small sample so that this issue can be reproduced by others (see [How to create a Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example)) – afsharov Jul 24 '21 at 09:36
  • I'm having the same issue with macOS. I will try now `pip install pycaret --force-reinstall` – igorkf Jul 29 '21 at 18:31

2 Answers2

4

You mentioned my previous question here.

I just faced the same issue as you on Colab. It is 100% issue with libraries.

Initially, I got the error for SMOTE:

  • `AttributeError: 'SMOTE' object has no attribute '_validate_data'

After installing/reinstalling libraries I got exactly your error.

How did I resolve it?

  • Started to run Colab and imported all common libraries (pd, np, scikit, etc).
  • Installed PyCaret via pip install. Then import pycaret and from pycaret.classification import *
  • Colab reacted: you have issues with scipy, sklearn, lightgbm, please restart your runtime.
  • Restarted my runtime on Colab
  • Imported all libraries again as I did in step 1
  • Ran import pycaret and from pycaret.classification import * only

My final code:

# Initialize the setup with SMOTE
clf_smote = setup(
    data,
    session_id = 123,
    target = 'Target',
    remove_multicollinearity = True,
    multicollinearity_threshold = 0.95, 
    fix_imbalance = True
)

I did not use imputation_type='iterative' as in my question above.

Proof of running:

It worked, but it was my solution. Would be great to have a more detailed guide on how to deal with such issues, using this amazing library.

Anakin Skywalker
  • 2,400
  • 5
  • 35
  • 63
2

Interestingly for me pip install scikit-learn==0.23.2 did the trick. It was the version.

ouflak
  • 2,458
  • 10
  • 44
  • 49