Explain Your Machine Learning Model Predictions with GPU-Accelerated SHAP

Originally published at: https://developer.nvidia.com/blog/explain-your-machine-learning-model-predictions-with-gpu-accelerated-shap/

Learn how to train an XGBoost model, implement the SHAP technique in Python using a CPU and GPU, and compare results between the two.

Thanks for checking out my blog on GPU accelerated SHAP values. Let me know if you have any questions about the blog or the code implementation.

First off, thanks a lot for such a good blog!
I think I should check something what I missed.

        shap.initjs()
        warnings.filterwarnings(action = "ignore")
        explainer = shap.TreeExplainer(model)
        shap_values = explainer.shap_values(X_test)
        fig = shap.summary_plot(shap_values, X_test, plot_type="bar")
        plt.savefig(os.path.join('shap_image.png'))

At Summary_plot,
it raise

Attempted to set non-positive bottom ylim on a log-scaled axis.
Invalid limit will be ignored.

and the progress never stop. what should I do?

Hi @94cogus ,

Firstly, apologies for replying late. I inadvertently missed the notification to your query. As for your issue, I tried it on my end but I encountered no error. Here is the link to the code that I tried let me know if you are still having issues reproducing the results : Google Colab