์ด PR ์์๋ test_algoritthms.py
ํ์ผ์ shap ํ
์คํธ(test_shap)๋ฅผ ํต๊ณผํ๊ธฐ ์ํด ENC์ ์ด๊ธฐํ ๋งค๊ฐ๋ณ์๋ฅผ ๋ณ๊ฒฝํฉ๋๋ค. init ๋งค๊ฐ๋ณ์๋ฅผ alpha = 0.0001
๋ฐ l1_ratio=0.15
๋ก ๋๋ฉด shap์ ๊ณ์ฐํ๋ ๋์ ZeroDivisionError
๊ฐ ๋ฐ์ํ์ผ๋ฉฐ ์ด๋ ์ด๊ฒ์ ์ฐ๊ฒฐ๋์์ ๊ฐ๋ฅ์ฑ
์ด ๋ฌธ์ ๋ฅผ ์ ์ถํ์ฌ ํ ์คํธ๊ฐ ์คํจํ ์ด์ ๋ฅผ ํ์ธํ๊ณ ์ด ์ค๋ฅ๋ฅผ ๋ฐฉ์งํ ์ ์๋ ์ข์ ๋ฐฉ๋ฒ์ ์ฐพ์ผ์ญ์์ค.
๋๋ ์ด๊ฒ์ด ์คํ ๋ฌธ์ ๋ผ๊ณ ์๊ฐํ๋ค. ํ ๋ก ์ ์ํด https://github.com/slundberg/shap/issues/2000 ์ ์ ์ถํ์ต๋๋ค. ๋จ๊ธฐ์ ์ผ๋ก๋ ๋ค์๊ณผ ๊ฐ์ด ํ ์ ์๋ค๊ณ ์๊ฐํฉ๋๋ค.
KernelExplainer
์ link="identity" ์ฌ์ฉexplainer = shap.LinearExplainer(classifier, X, link=shap.links.logit)
์คํจํ ์ถ๊ฐ ํ ์คํธ:
์ด ํ
์คํธ๋ฅผ evalml/tests/model_understanding_tests/prediction_explaination_tests/test_explainers.py
์ถ๊ฐํ๋ฉด ๋ฉ์ธ์์ alpha=0.5, l1_ratio=0.5
๋ฅผ ์ฌ์ฉ ํฉ๋๋ค .
@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๋ก ๋ง๋ฌด๋ฆฌ