LIME로 로컬 설명 가능성

Python으로 배우는 Explainable AI

Fouad Trad

Machine Learning Engineer

  • LIMELocal Interpretable Model-Agnostic Explanations
  • 복잡한 모델의 예측을 설명
  • 개별 인스턴스 단위로 작동
  • 모델 유형과 무관

LIME 로고.

Python으로 배우는 Explainable AI

LIME 설명기

  • 다양한 데이터 유형에 맞춤

사용 가능한 LIME 설명기 다이어그램. 첫 번째는 LIME 표 설명기.

Python으로 배우는 Explainable AI

LIME 설명기

  • 다양한 데이터 유형에 맞춤

텍스트 설명기가 추가로 표시된 동일한 다이어그램.

Python으로 배우는 Explainable AI

LIME 설명기

  • 다양한 데이터 유형에 맞춤
  • 샘플 주변에 섭동 생성
  • 모델 출력에 미치는 영향 확인
  • 설명을 위한 단순한 모델 구성

이미지 설명기가 추가로 표시된 동일한 다이어그램.

Python으로 배우는 Explainable AI

LIME 설명기

  • 다양한 데이터 유형에 맞춤
  • 샘플 주변에 섭동 생성
  • 모델 출력에 미치는 영향 확인
  • 설명을 위한 단순한 모델 구성

표 형식 설명기가 강조된 동일한 다이어그램.

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

 

  • regressor: 합격 확률 예측
  • classifier: 합격 여부 예측
  • 특징은 X에 있음
Python으로 배우는 Explainable AI

표 데이터 설명기 만들기

회귀
from lime.lime_tabular import LimeTabularExplainer

instance = X.iloc[1,:]
explainer_reg = LimeTabularExplainer( X.values,
feature_names=X.columns,
mode='regression'
)
explanation_reg = explainer_reg.explain_instance(
instance.values,
regressor.predict
)
분류
from lime.lime_tabular import LimeTabularExplainer

instance = X.iloc[1,:]
explainer_class = LimeTabularExplainer( X.values,
feature_names=X.columns,
mode='classification'
)
explanation_class = explainer_class.explain_instance(
instance.values,
classifier.predict_proba
)
Python으로 배우는 Explainable AI

설명 시각화

회귀
explanation_reg.as_pyplot_figure()

회귀 모델에서 각 특징의 영향을 보여주는 막대 그래프. 해석을 돕기 위해 특징이 범위 내에 배치됨.

분류
explanation_class.as_pyplot_figure()

분류 모델에서 각 특징의 영향을 보여주는 막대 그래프. 해석을 돕기 위해 특징이 범위 내에 배치됨.

Python으로 배우는 Explainable AI

SHAP vs. LIME

SHAP
shap.waterfall_plot(...)

각 특징이 예측을 양/음으로 얼마나 밀어주는지 보여주는 SHAP 폭포형 그래프.

LIME
explanation_class.as_pyplot_figure()

분류 모델에서 각 특징의 영향을 보여주는 막대 그래프. 해석을 돕기 위해 특징이 범위 내에 배치됨.

Python으로 배우는 Explainable AI

Ayo berlatih!

Python으로 배우는 Explainable AI

Preparing Video For Download...