Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2019 11:29 AM
I am looking to display SHAP plots, here is the code:
import xgboost import shapshap.initjs() # load JS visualization code to notebookX,y = shap.datasets.boston() # train XGBoost model
model = xgboost.train({"learning_rate": 0.01}, xgboost.DMatrix(X, label=y), 100)
explainer = shap.TreeExplainer(model) # explain the model's predictions using SHAP values
shap_values = explainer.shap_values(X)
shap_explain = shap.force_plot(explainer.expected_value, shap_values[0,:], X.iloc[0,:]) # visualize the first prediction's explanation
displayHTML(shap_explain.data) # display plot
However I am receiving the following error:
Any help greatly appreciated!
Labels:
- Labels:
-
Displayhtml
-
Shap