Evalml: 弹性网络分类器估计器的 SHAP 测试失败

创建于 2021-05-17  ·  4评论  ·  资料来源: alteryx/evalml

此 PR 中,我们更改 ENC 的初始化参数以通过test_algoritthms.py文件中的 shap 测试 (test_shap)。 将 init 参数保留为alpha = 0.0001l1_ratio=0.15 ZeroDivisionError在计算 shap 时会导致this 相关

提交此问题以确定测试失败的原因并找出避免此错误的好方法。

所有4条评论

我认为这是一个shap问题。 我提交了https://github.com/slundberg/shap/issues/2000进行讨论。 短期内,我认为我们可以做到以下几点:

  • KernelExplainer中的 link="identity" 用于线性模型
  • 使用带有 logit 链接的LinearExplainerexplainer = 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

测试失败:
image

如果我们更改 alpha 和 l1_ratio,它仍然失败。

好的@bchen1116 ,去做吧。

以此 PR结束

此页面是否有帮助?
0 / 5 - 0 等级