interpretml / interpret

Fit interpretable models. Explain blackbox machine learning.
https://interpret.ml/docs
MIT License
6.04k stars 715 forks source link

Attribute ERROR from interpret/utils/_clean_x.py #500

Closed flaxmans closed 4 months ago

flaxmans commented 4 months ago

Hi, I've fit an explanable boosting classifier (ebc) and I'm trying to use that model object to make predictions. However, I'm getting the following error when trying to call ebc.predict_proba(my_feature_data_frame) :

File /opt/conda/lib/python3.10/site-packages/interpret/utils/_clean_x.py:1157, in unify_columns(X, requests, feature_names_in, feature_types, min_unique_continuous, go_fast)
   1155     for name, n_count in Counter(map(str, names_original)).items():
   1156         if n_count != 1:
-> 1157             names_dict.remove(name)
   1159 if feature_types is None:
   1160     for feature_name_in in feature_names_in:

AttributeError: 'dict' object has no attribute 'remove'

This code block in _clean_x.py was reached because I did erroneously have a duplicated column in my_feature_data_frame. However, as the error message indicates, .remove() is not a valid method on objects of type dict.

paulbkoch commented 4 months ago

Thanks @flaxmans -- You're right, for dictionaries this should be "del names_dict[name]". names_dict was previously a set, which uses "remove" instead of "del".

Fixed in https://github.com/interpretml/interpret/commit/4d996d56c4ce955b0cdae42ff888a002bbe18aee