Giter VIP home page Giter VIP logo

Comments (4)

hungngocphat01 avatar hungngocphat01 commented on September 26, 2024 1

I just simply ran export OMP_NUM_THREADS=24 in the shell before executing the python script used to calculate shap scores.

from shap.

CloseChoice avatar CloseChoice commented on September 26, 2024

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.

hungngocphat01 avatar hungngocphat01 commented on September 26, 2024

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.

CloseChoice avatar CloseChoice commented on September 26, 2024

Would you mind sharing the code to set the config? Would be great for future reference

from shap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.