LIME के साथ लोकल explainability

Python में Explainable AI

Fouad Trad

Machine Learning Engineer

  • LIMELocal Interpretable Model-Agnostic Explanations
  • जटिल मॉडलों की भविष्यवाणियाँ समझाता है
  • व्यक्तिगत इंस्टेंस पर काम करता है
  • मॉडल टाइप से अग्नॉस्टिक

LIME लोगो.

Python में Explainable AI

Lime explainers

  • अलग-अलग तरह के डेटा के लिए टेलर्ड

उपलब्ध LIME explainers दिखाता डायग्राम. पहला LIME tabular explainer है.

Python में Explainable AI

Lime explainers

  • अलग-अलग तरह के डेटा के लिए टेलर्ड

वही डायग्राम, अब Text Explainer भी दिखता है.

Python में Explainable AI

Lime explainers

  • अलग-अलग तरह के डेटा के लिए टेलर्ड
  • किसी सैंपल के आसपास perturbations जनरेट करता है
  • मॉडल के आउटपुट पर प्रभाव देखता है
  • समझाने के लिए सरल मॉडल बनाता है

वही डायग्राम, अब Image Explainer भी दिखता है.

Python में Explainable AI

Lime explainers

  • अलग-अलग तरह के डेटा के लिए टेलर्ड
  • किसी सैंपल के आसपास perturbations जनरेट करता है
  • मॉडल के आउटपुट पर प्रभाव देखता है
  • समझाने के लिए सरल मॉडल बनाता है

वही डायग्राम, Tabular explainer हाइलाइटेड है.

Python में Explainable AI

Admissions डेटासेट

GRE Score TOEFL Score University Rating SOP LOR CGPA Chance of Admit Accept
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: admit की संभावना predict करता है
  • classifier: acceptance predict करता है
  • फीचर्स X में हैं
Python में Explainable AI

Tabular explainer बनाना

Regression
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
)
Classification
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

व्याख्या को विजुअलाइज़ करना

Regression
explanation_reg.as_pyplot_figure()

बार प्लॉट जो हर फीचर का regression मॉडल पर प्रभाव दिखाता है. बेहतर interpretability के लिए फीचर्स को एक रेंज में रखा गया है.

Classification
explanation_class.as_pyplot_figure()

बार प्लॉट जो हर फीचर का classification मॉडल पर प्रभाव दिखाता है. बेहतर interpretability के लिए फीचर्स को एक रेंज में रखा गया है.

Python में Explainable AI

SHAP बनाम LIME

SHAP
shap.waterfall_plot(...)

SHAP वॉटरफॉल प्लॉट जो दिखाता है कि हर फीचर भविष्यवाणी को सकारात्मक या नकारात्मक दिशा में कितना धकेलता है.

LIME
explanation_class.as_pyplot_figure()

बार प्लॉट जो हर फीचर का classification मॉडल पर प्रभाव दिखाता है. बेहतर interpretability के लिए फीचर्स को एक रेंज में रखा गया है.

Python में Explainable AI

अभ्यास करते हैं!

Python में Explainable AI

Preparing Video For Download...