C.W.K.
Stream
Lesson 02 of 05 · published

Feature Importance

~28 min · importance, interpretation

Level 0Scout
0 XP0/48 lessons0/11 achievements
0/120 XP to next level120 XP to go0% complete

importance의 세 flavor

  • 내장 tree importance — 빠르지만 high-cardinality feature 쪽으로 biased.
  • Permutation importance — 모델 무관, feature shuffle 후 score 하락 측정. 정직하지만 비쌈.
  • SHAP value — prediction 별 contribution. 비싸지만 local 설명에 강력.

importance가 뭐고 뭐가 아닌가

Importance가 현재 데이터 분포 아래 predictive contribution 측정. causality 아님. intervention 아래 stability 아님. feature가 매우 중요해도 act 하기 잘못일 수 있어, action이 분포를 바꿀 거니까.

잘 communicate

top-10을 절댓값 score와 함께 보여줘, 모양(positive vs negative direction) 위해 SHAP summary plot 추가. 팀이 신뢰하는 sanity check column 항상 포함. 모델이 중요 안 하다고 하는데 팀이 중요하다고 알면, 데이터나 framing이 잘못됨.

Code

default로 permutation importance·python
from sklearn.inspection import permutation_importance

result = permutation_importance(
    model, X_val, y_val, n_repeats=20, random_state=7,
    scoring="average_precision", n_jobs=-1
)
for name, score in sorted(zip(X_val.columns, result.importances_mean), key=lambda kv: -kv[1])[:10]:
    print(f"{score:+.4f}  {name}")
local explanation 위한 SHAP·python
import shap

explainer = shap.TreeExplainer(model)
shap_values = explainer.shap_values(X_val.sample(500, random_state=7))
shap.summary_plot(shap_values, X_val.sample(500, random_state=7))

External links

Exercise

모델에 대해 permutation importance와 SHAP summary 계산. top-10을 팀 기대치와 cross-check. ship 전 가장 큰 disagreement 조사.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.