This should work:
from clearml import Task
task = Task.init(project_name="examples", task_name="shap example")
import xgboost
import shap
# train an XGBoost model
X, y = shap.datasets.california()
model = xgboost.XGBRegressor().fit(X, y)
# explain the model's predictions using SHAP
# (same syntax works for LightGBM, CatBoost, scikit-learn, transformers, Spark, etc.)
explainer = shap.Explainer(model)
shap_values = explainer(X)
# visualize the first prediction's explanation
shap.plots.waterfall(shap_values[0])
Hi @<1787291173992271872:profile|BlandCormorant75> , how are you logging those plots? Can you provide a stand alone snippet that reproduces your behaviour?
Hey, good day and thank you for your quick replies! So this is the code snippet I was using to create the plots (see appended image). I also tried removing the plt.savefig() part or the plt.show() part or manually adding the report_matplotlib_figure-part for the task but nothing seems to make a difference.
"plt" comes from matplotlib.pyplot and as I understand the clearML documentation, matplotlib plots are logged automatically. In other scripts, this works just fine but not with these SHAP-plots that are just displayed as empty plots:
Hmm Could you check if it makes a difference importing ClearML before shap ?
If this changes nothing, could you put a standalone script to reproduce the issue ?