Permutation 중요도

Python으로 배우는 Explainable AI

Fouad Trad

Machine Learning Engineer

셔플로 악기 중요도 알아보기

여러 악기를 연주하는 밴드를 보여주는 이미지.

Python으로 배우는 Explainable AI

Permutation 중요도

  • 모델 비종속적 방법
  • 특성 중요도 평가
    • 특성 셔플이 성능에 미치는 영향 측정
  • 매우 범용적

여러 은닉층과 다수의 뉴런으로 구성된 신경망 구조 이미지.

Python으로 배우는 Explainable AI

Permutation 중요도 실습

특성 5개와 학습된 ML 모델의 데이터셋 이미지를 보여줌.

Python으로 배우는 Explainable AI

Permutation 중요도 실습

데이터셋을 ML 모델에 넣어 기준 성능을 얻는 모습을 보여주는 이미지.

Python으로 배우는 Explainable AI

Permutation 중요도 실습

원본 데이터셋에서 한 특성의 값이 [1, 2, 3, 4]였고 셔플 후 [4, 2, 1, 3]으로 바뀌는 모습을 보여주는 이미지. 셔플된 데이터셋을 ML 모델에 넣어 셔플 후 성능을 얻습니다.

Python으로 배우는 Explainable AI

Permutation 중요도 실습

셔플된 특성의 중요도가 성능 하락폭에 비례함을 보여주는 이미지.

Python으로 배우는 Explainable AI

Permutation 중요도 실습

큰 하락은 해당 특성의 중요도가 높음을, 작은 하락은 중요도가 낮음을 시사함을 보여주는 이미지.

Python으로 배우는 Explainable AI

입학 데이터셋

GRE 점수 TOEFL 점수 대학 평가 SOP LOR CGPA 합격 확률 합격
337 118 4 4.5 4.5 9.65 0.92 1
324 107 4 4 4.5 8.87 0.76 1
316 104 3 3 3.5 8 0.72 1
322 110 3 3.5 2.5 8.67 0.8 1
314 103 2 2 3 8.21 0.45 0

 

데이터는 다음에 있습니다: X_train, y_train

Python으로 배우는 Explainable AI

MLPClassifier

from sklearn.neural_network import MLPClassifier
model = MLPClassifier(hidden_layer_sizes=(10,10))

model.fit(X_train, y_train)
Python으로 배우는 Explainable AI

Permutation 중요도

from sklearn.inspection import permutation_importance

result = permutation_importance(model,
X_train, y_train,
n_repeats=10,
random_state=42,
scoring='accuracy')
print(result.importances_mean)
[0.16213568 0.13831658 0.10575377 0.10522613 0.11741206 0.20072864]
Python으로 배우는 Explainable AI

중요도 시각화

import matplotlib.pyplot as plt
plt.bar(X_train.columns,
        result.importances_mean)

Permutation 중요도 막대그래프. CGPA가 가장 높음을 보여줌.

Python으로 배우는 Explainable AI

모델별 접근법과 비교

import matplotlib.pyplot as plt
plt.bar(X_train.columns, 
        result.importances_mean)

Permutation 중요도 막대그래프. CGPA가 가장 높음을 보여줌.

로지스틱 회귀
plt.bar(X_train.columns, np.abs(log_reg.coef_[0]))

로지스틱 회귀 계수 막대그래프. CGPA가 가장 높음을 보여줌.

Python으로 배우는 Explainable AI

¡Vamos a practicar!

Python으로 배우는 Explainable AI

Preparing Video For Download...