我认为这是一个shap问题。 我提交了https://github.com/slundberg/shap/issues/2000进行讨论。 短期内,我认为我们可以做到以下几点:
KernelExplainer
中的 link="identity" 用于线性模型explainer = shap.LinearExplainer(classifier, X, link=shap.links.logit)
失败的进一步测试:
在 main 上,使用alpha=0.5, l1_ratio=0.5
,这是我们在此之前拥有的,如果我们将此测试添加到evalml/tests/model_understanding_tests/prediction_explaination_tests/test_explainers.py
:
@pytest.mark.parametrize("estimator", ["Extra Trees Classifier", "Elastic Net Classifier"])
def test_elastic_net(estimator, fraud_100):
pytest.importorskip('imblearn', reason='Skipping test because imblearn not installed')
X, y = fraud_100
pipeline = BinaryClassificationPipeline(component_graph=["Imputer", "One Hot Encoder", "DateTime Featurization Component", estimator])
pipeline.fit(X=X, y=y)
pipeline.predict(X)
importance = explain_predictions(pipeline, X, y, indices_to_explain=[0], top_k_features=4)
assert report['feature_names'].isnull().sum() == 0
assert report['feature_values'].isnull().sum() == 0
测试失败:
如果我们更改 alpha 和 l1_ratio,它仍然失败。
好的@bchen1116 ,去做吧。
以此 PR结束