これは簡単な問題だと思います。 ディスカッションのためにhttps://github.com/slundberg/shap/issues/2000を提出しました。 短期的には、次のことができると思います。
KernelExplainer
でlink = "identity"を使用しますexplainer = shap.LinearExplainer(classifier, X, link=shap.links.logit)
LinearExplainerを使用する失敗した別のテスト:
メインで使用して、 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で締めくくります