Comments (4)
I just simply ran export OMP_NUM_THREADS=24
in the shell before executing the python script used to calculate shap scores.
from shap.
Xgboost implemented calculation of shap values for us and we basically just call this functionality. Hence it should be possible to limit the number of threads (not cores though) with the global config of xgboost.
import xgboost as xgb
# Show all messages, including ones pertaining to debugging
xgb.set_config(nthread=10, verbosity=2)
# call shap ...
Would be great if you could report back if this helped. This is a bit of a tricky situation for us since we support a number of backends and not all might conform to the same interface. So adding a parameter that limits this might not be available for other libraries etc. Maybe we need to do some digging for catboost, lightgbm and sklearn (sklearn definitely has that).
from shap.
The problem really lies in xgboost's implementation as you mentioned. Setting the OMP_NUM_THREADS environment variable solved my problem. Thank you very much.
By the way, the nthread
xgboost config cannot be set with xgb.set_config.
from shap.
Would you mind sharing the code to set the config? Would be great for future reference
from shap.
Related Issues (20)
- Intrepreting Siamese Network using SHAP values HOT 5
- ENH: Support SeLU activations for Tensorflow DeepExplainer
- BUG: AssertionError: The SHAP explanations do not sum up to the model's output HOT 1
- [Meta-issue] deprecation tracker for upcoming releases HOT 2
- BUG: missing **dmatrix_props in shape_interaction module HOT 1
- BUG: TreeExplainer ignores "link" argument passed by the Explainer API HOT 1
- BUG: SHAP Partition explainer fails for a single token text input HOT 5
- BUG: Shap value cannot be calculated according to NLP tutorial on the original website HOT 17
- Segmentation Fault on MacOS with pytorch > 2.2.0 HOT 4
- ENH: Faster import performance HOT 1
- ENH: Label dots in scatterplot according to classes and add a legend
- BUG: SHAP DeepExplainer cannot get SHAP values from TorchScript model HOT 1
- CIBuildWheel failing on windows runners
- [Meta issue] Release 0.45.0 HOT 5
- BUG: Waterfall feature names IndexError HOT 1
- BUG: DeepExplainer throws error when using `__call__`
- CI failing on tensorflow 2.16+ due to incompatibility between transformers & keras V3
- BUG: Output 0 of BackwardHookFunctionBackward is a view and is being modified inplace. This view was created inside a custom Function (or because an input was returned as-is) and the autograd logic to handle view+inplace would override the custom backward associated with the custom Function, leading to incorrect gradients. This behavior is forbidden. You can fix this by cloning the output of the custom Functio HOT 3
- ENH: Display worst features with barplot
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shap.