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

Pipeline isn't supported by TreeExplainer #3880

Closed
suhaibmujahid opened this issue Dec 3, 2023 · 1 comment · Fixed by #3883
Closed

Pipeline isn't supported by TreeExplainer #3880

suhaibmujahid opened this issue Dec 3, 2023 · 1 comment · Fixed by #3883
Assignees
Labels
bug Something isn't working

Comments

@suhaibmujahid
Copy link
Member

Hi! I'm trying to work on this issue, and according to the README.md, I start using the bugbug library by running the trainer.py script with the StepsToReproduce model by running python3 -m scripts.trainer stepstoreproduce in the bugbug directory.

However, I got the following result stating that the imblearn.pipeline.Pipeline model isn't supported by TreeExplainer. Can I safely ignore this, or do I have to resolve this issue first before working on the rest of the issue? Thanks!

(base) naoyaokamoto@Naoyas-MacBook-Air-393 bugbug % python3 -m scripts.trainer stepstoreproduce
2023-12-03 15:31:40,852:INFO:numexpr.utils:NumExpr defaulting to 8 threads.
2023-12-03 15:31:46,253:INFO:bugbug.db:Downloading https://community-tc.services.mozilla.com/api/index/v1/task/project.bugbug.data_bugs.latest/artifacts/public/bugs.json.zst to data/bugs.json.zst
data/bugs.json.zst  : 2328191107 bytes                                         
2023-12-03 15:32:57,619:INFO:__main__:Training *stepstoreproduce* model
2023-12-03 15:33:04,232:INFO:bugbug.models.stepstoreproduce:29 bugs have no steps to reproduce
2023-12-03 15:33:04,233:INFO:bugbug.models.stepstoreproduce:4693 bugs have steps to reproduce
2023-12-03 15:33:13,319:INFO:bugbug.model:X: (4722, 4), y: (4722,)
2023-12-03 15:33:18,377:INFO:bugbug.model:Cross Validation scores:
2023-12-03 15:33:18,377:INFO:bugbug.model:Accuracy: f0.6924007482851798 (+/- 0.022998486956704086)
2023-12-03 15:33:18,377:INFO:bugbug.model:Precision: f0.9976212992231602 (+/- 0.0026638832893729376)
2023-12-03 15:33:18,377:INFO:bugbug.model:Recall: f0.692237303345579 (+/- 0.023732875522107115)
2023-12-03 15:33:18,377:INFO:bugbug.model:X_train: (4249, 4), y_train: (4249,)
2023-12-03 15:33:18,377:INFO:bugbug.model:X_test: (473, 4), y_test: (473,)
2023-12-03 15:33:19,435:INFO:bugbug.model:Number of features: 75318
2023-12-03 15:33:19,436:INFO:bugbug.model:Model trained
Traceback (most recent call last):
  File "/Users/naoyaokamoto/mambaforge/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Users/naoyaokamoto/mambaforge/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/Users/naoyaokamoto/Documents/GitHub/bugbug/scripts/trainer.py", line 145, in <module>
    main()
  File "/Users/naoyaokamoto/Documents/GitHub/bugbug/scripts/trainer.py", line 141, in main
    retriever.go(args)
  File "/Users/naoyaokamoto/Documents/GitHub/bugbug/scripts/trainer.py", line 41, in go
    metrics = model_obj.train(limit=args.limit)
  File "/Users/naoyaokamoto/Documents/GitHub/bugbug/bugbug/model.py", line 402, in train
    explainer = shap.TreeExplainer(self.clf)
  File "/Users/naoyaokamoto/mambaforge/lib/python3.10/site-packages/shap/explainers/_tree.py", line 166, in __init__
    self.model = TreeEnsemble(model, self.data, self.data_missing, model_output)
  File "/Users/naoyaokamoto/mambaforge/lib/python3.10/site-packages/shap/explainers/_tree.py", line 1155, in __init__
    raise InvalidModelError("Model type not yet supported by TreeExplainer: " + str(type(model)))
shap.utils._exceptions.InvalidModelError: Model type not yet supported by TreeExplainer: <class 'imblearn.pipeline.Pipeline'>

Originally posted by @naoya2000 in #792 (comment)

@suhaibmujahid
Copy link
Member Author

Regressed by #3877

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant