当我使用的时候:
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)发布于 2021-01-27 06:35:43
您使用哪种SHAP?请检查一下。
print(shap.__version__)另外,你是通过pip还是conda安装SHAP的?当你运行脚本时,你的python访问在哪里?我想,在这样的检查之后,你会得到发生了什么事情的答案。
https://stackoverflow.com/questions/65643941
复制相似问题