Shapley for Logistic regression?



shapley支持逻辑回归模型吗?

运行以下代码我得到:

logmodel = LogisticRegression()
logmodel.fit(X_train,y_train)
predictions = logmodel.predict(X_test)
explainer = shap.TreeExplainer(logmodel )
Exception: Model type not yet supported by TreeExplainer: <class 'sklearn.linear_model.logistic.LogisticRegression'>

第页。S.你应该对不同型号的使用不同的解释

Shap根据定义是模型不可知的。看起来你刚刚选择了一个不适合你模特类型的解说员。我建议查看KernelExplainer,正如这里的创建者所描述的,它是

Kernel SHAP的实现,这是一种模型不可知的方法,用于估计任何模型的SHAP值。因为KernelExplainer不对模型类型进行假设,所以它比其他特定于模型类型的算法慢。

Shap的文档大部分都很扎实,并且有一些不错的示例。

explainer = shap.LinearExplainer(logmodel)应该起作用,因为逻辑回归是一个线性模型。

逻辑回归是一个线性模型,因此应该使用线性解释器。

最新更新