Switch CatBoost reference to __builtin__ method (Python 2) to builtins (Python 3). This error causes SHAP feature importance method to break
@@ -2006,7 +2006,7 @@ class CatBoost(_CatBoostBase):
if type == EFstrType.PredictionDiff:
if data is None and isinstance(data, Pool):
- from __builtin__ import type as typeof
+ from builtins import type as typeof
raise CatBoostError("Invalid data type={}, must be list or np.array".format(typeof(data)))
data, _ = self._process_predict_input_data(data, "get_feature_importance")
@@ -2015,7 +2015,7 @@ class CatBoost(_CatBoostBase):
else:
if data is not None and not isinstance(data, Pool):
- from __builtin__ import type as typeof
+ from builtins import type as typeof
raise CatBoostError("Invalid data type={}, must be catboost.Pool.".format(typeof(data)))
need_meta_info = type == EFstrType.PredictionValuesChange
