作者: 左手Python右手R
作者简介: 工作VX:h614379155
描述: 步骤一:java环境变量 的配置与详解(全网最详细教程) https://blog.csdn.net/qq_41436122/article/details/82620080 步骤二:jupyter notebook安装IJava内核 详细解说 https://blog.csdn.net/m0_66581248/article/details/122726060 步骤三:微信推文:一个神奇的 Python 库 SHAP 步骤四:将代码换个显示方式import xgboost import shap 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.TreeExplainer(model) shap_values = explainer.shap_values(X) # visualize the first prediction's explanation shap.force_plot(explainer.expected_value, shap_values[0,:], X.iloc[0,:], matplotlib=True)