Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to use SHAP with sklearn pipeline? #6

Closed
santokalayil opened this issue Jan 6, 2022 · 2 comments
Closed

Is it possible to use SHAP with sklearn pipeline? #6

santokalayil opened this issue Jan 6, 2022 · 2 comments

Comments

@santokalayil
Copy link

santokalayil commented Jan 6, 2022

Is it possible to use SHAP with sklearn pipeline (in my use case imblearn pipeline) where final estimator is XGBoost?

@santokalayil
Copy link
Author

santokalayil commented Jan 6, 2022

I need to use this pipe:

transformers_list.append(("category", OneHotEncoder(handle_unknown="ignore"), features_dict['cat_features']))
transformers_list.append(("numeric", RobustScaler(), features_dict['num_features']))

preprocessor = ColumnTransformer(
    transformers=transformers_list,
    remainder="passthrough", # error(default)
)
pipe = Pipeline(steps=[
    ("preprocessor", preprocessor), 
    ("over_sampling", SMOTE()), 
    ("classifier", clf_xgb)
] )```



with something like this:


model = BoostBoruta(
pipe._final_estimator, param_grid=param_grid, max_iter=200, perc=100,
importance_type='shap_importances', train_importance=False
)```

@cerlymarco
Copy link
Owner

cerlymarco commented Jan 6, 2022

@santokalayil all classes available in shap-hypetune are developed as sklearn BaseEstimator. This means that you can simply use them as any other sklearn models.

If you support the project don't forget to leave a star ;-)

all the best

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants