当我使用时:
gb_explainer = shap.TreeExplainer
我收到此错误:
AttributeError: module 'shap' has no attribute 'TreeExplainer'
完整代码:
def create_shap_tree_explainer(self):
self.gb_explainer = shap.TreeExplainer(self.gb_model)
self.shap_values_X_test = self.gb_explainer.shap_values(self.X_test)
self.shap_values_X_train = self.gb_explainer.shap_values(self.X_train)
梯度提升分类器模型为:
gbc_model = Create_Gradient_Boosting_Classifier(X_train, y_train, ps)