LIME के साथ टेक्स्ट और इमेज explainability

Python में Explainable AI

Fouad Trad

Machine Learning Engineer

टेक्स्ट-आधारित मॉडल

  • लिखित भाषा को प्रोसेस करें और समझें
  • उदाहरण: Sentiment analysis
  • Black box मॉडल
  • ऐसे मॉडलों को LimeTextExplainer समझाता है
    • हर शब्द का prediction पर प्रभाव ढूँढता है

यूज़र रिव्यू लेने और सम्बंधित sentiment ('Positive' या 'Negative') प्रेडिक्ट करने वाला सेंटिमेंट एनालिसिस मॉडल।

Python में Explainable AI

LIME टेक्स्ट एक्सप्लेनर

from lime.lime_text import LimeTextExplainer

text_instance = "This product has great features but a poor design."
def model_predict(instance): ... return class_probabilities
explainer = LimeTextExplainer()
exp = explainer.explain_instance(
text_instance,
model_predict
)
exp.as_pyplot_figure()

output_sentiment.png

Python में Explainable AI

इमेज-आधारित मॉडल

  • अत्यंत complex
  • विज़ुअल डेटा को interpret करें
  • उदाहरण: Food classification
  • ऐसे मॉडलों को LimeImageExplainer समझाता है
    • इमेज के वे हिस्से ढूँढता है जो predictions को प्रभावित करते हैं

पिज़्ज़ा की इमेज लेकर इमेज में कौन-सा food है, यह प्रेडिक्ट करने वाला फूड क्लासिफिकेशन मॉडल।

Python में Explainable AI

LIME इमेज एक्सप्लेनर

from lime.lime_image import LimeImageExplainer

explainer = LimeImageExplainer()
explanation = explainer.explain_instance(
image,
model_predict,
num_samples=50
)
temp, _ = explanation.get_image_and_mask(
explanation.top_labels[0],
hide_rest=True
)

आइसक्रीम की इमेज.

Python में Explainable AI

LIME इमेज एक्सप्लेनर

from lime.lime_image import LimeImageExplainer

explainer = LimeImageExplainer()
explanation = explainer.explain_instance(
  image, 
  model_predict,  
  num_samples=50
)

temp, _ = explanation.get_image_and_mask(
  explanation.top_labels[0], 
  hide_rest=True
)

plt.imshow(temp)

कम महत्वपूर्ण हिस्सों को काले रंग से छुपाई गई आइसक्रीम इमेज।

Python में Explainable AI

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

Python में Explainable AI

Preparing Video For Download...