تحليل القرار الخاطئ لنموذج التنبؤ باستخدام LIME - كتاب الذكاء الإصطناعي - الصف 12 - الفصل 1 - المملكة العربية السعودية

الكتاب: كتاب الذكاء الإصطناعي - الصف 12 - الفصل 1 | المادة: الذكاء الإصطناعي | المرحلة: الصف 12 | الفصل الدراسي: 1

الدولة: المملكة العربية السعودية | المنهج: المنهج السعودي - وزارة التعليم

الدرس: تفسير قرارات نماذج التعلم الآلي باستخدام LIME

📚 معلومات الصفحة

الكتاب: كتاب الذكاء الإصطناعي - الصف 12 - الفصل 1 | المادة: الذكاء الإصطناعي | المرحلة: الصف 12 | الفصل الدراسي: 1

الدولة: المملكة العربية السعودية | المنهج: المنهج السعودي - وزارة التعليم

نوع المحتوى: example

مستوى الصعوبة: متوسط

📝 ملخص الصفحة

تقدم هذه الصفحة مثالاً عملياً لتحليل قرار خاطئ اتخذه نموذج تنبؤ في تصنيف النصوص، حيث صنف تقييماً إيجابياً بشكل خاطئ على أنه سلبي باحتمالية عالية تصل إلى 83%. يتم استخدام أداة LIME (Local Interpretable Model-agnostic Explanations) لتفسير هذا القرار من خلال عرض المساهمات الفردية للكلمات في التنبؤ.

يوضح الشكل 3.11 الكلمات التي أثرت على القرار الخاطئ، حيث يظهر أن النموذج استنتج بشكل صحيح التأثير الإيجابي لكلمات مثل 'beautifully' و'great' و'superb'، لكنه اتخذ قراراً سلبياً استناداً إلى كلمات مثل 'Asano' و'Asian' و'movie' و'acting' التي لا تعبر بوضوح عن المشاعر السلبية.

يكشف هذا التحليل عن عيوب في منطق النموذج لتصنيف المفردات، مما يسلط الضوء على أهمية تفسير القرارات في نماذج التعلم الآلي لفهم أسباب الأخطاء وتحسين الأداء. القسم التالي يوضح كيفية تحسين هذا المنطق لتعزيز دقة النموذج.

📋 المحتوى المنظم

📖 محتوى تعليمي مفصّل

نوع: محتوى تعليمي

# get the correct labels of this example. print('Correct Label:', class_names[Y_test[4600]])

نوع: محتوى تعليمي

# get the prediction probabilities for this example. print('Prediction Probabilities for neg, pos:', prediction_pipeline_v1.predict_proba([mistake_example]))

نوع: محتوى تعليمي

Correct Label: pos Prediction Probabilities for neg, pos: [[0.8367931 0.1632069]]

نوع: محتوى تعليمي

على الرغم من أن هذا التقييم إيجابي بشكل واضح، إلا أن نموذج التنبؤ قدّم تنبؤًا سلبيًا مؤكدًا للغاية باحتمالية وصلت إلى 83%. يمكن الآن استخدام المفسّر لتوضيح السبب وراء اتخاذ نموذج التنبؤ مثل هذا القرار الخاطئ:

نوع: محتوى تعليمي

# explain the prediction for this example. exp = explainer_v1.explain_instance(mistake_example, prediction_pipeline_ v1.predict_proba, num_features=10)

نوع: محتوى تعليمي

# visualize the explanation. fig = exp.as_pyplot_figure()

شكل 3.11: الكلمات التي أثرت على القرار الخاطئ

نوع: FIGURE_REFERENCE

شكل 3.11: الكلمات التي أثرت على القرار الخاطئ

نوع: محتوى تعليمي

على الرغم من أن نموذج التنبؤ يستنبط التأثير الإيجابي لبعض الكلمات على نحو صحيح مثل: beautifully (بشكل جميل)، great (رائع)، superb (مدهش)، إلا أنه يتخذ في النهاية قرارًا سلبيًا استنادًا إلى العديد من الكلمات التي يبدو أنها لا تعبر بشكل واضح عن المشاعر السلبية مثل: Asano (أسانيو)، Asian (آسيوي)، movie (فيلم)، و acting (تمثيل). وهذا يوضح العيوب الكبيرة في المنطق الذي يستخدمه نموذج التنبؤ لتصنيف المفردات الواردة في نصوص التقييمات المقدمة. القسم التالي يوضح كيف أن تحسين هذا المنطق يمكن أن يطور من أداء نموذج التنبؤ إلى حد كبير.

نوع: METADATA

وزارة التعليم Ministry of Education 145 2025 - 1447

🔍 عناصر مرئية

Local explanation for class pos

A horizontal bar chart showing the local explanation for a positive class prediction. It illustrates the contribution of different words (features) to the model's prediction. Red bars indicate negative contributions, and green bars indicate positive contributions.

📄 النص الكامل للصفحة

# get the correct labels of this example. print('Correct Label:', class_names[Y_test[4600]])# get the prediction probabilities for this example. print('Prediction Probabilities for neg, pos:', prediction_pipeline_v1.predict_proba([mistake_example]))Correct Label: pos Prediction Probabilities for neg, pos: [[0.8367931 0.1632069]]على الرغم من أن هذا التقييم إيجابي بشكل واضح، إلا أن نموذج التنبؤ قدّم تنبؤًا سلبيًا مؤكدًا للغاية باحتمالية وصلت إلى 83%. يمكن الآن استخدام المفسّر لتوضيح السبب وراء اتخاذ نموذج التنبؤ مثل هذا القرار الخاطئ:# explain the prediction for this example. exp = explainer_v1.explain_instance(mistake_example, prediction_pipeline_ v1.predict_proba, num_features=10)# visualize the explanation. fig = exp.as_pyplot_figure()--- SECTION: شكل 3.11: الكلمات التي أثرت على القرار الخاطئ --- شكل 3.11: الكلمات التي أثرت على القرار الخاطئعلى الرغم من أن نموذج التنبؤ يستنبط التأثير الإيجابي لبعض الكلمات على نحو صحيح مثل: beautifully (بشكل جميل)، great (رائع)، superb (مدهش)، إلا أنه يتخذ في النهاية قرارًا سلبيًا استنادًا إلى العديد من الكلمات التي يبدو أنها لا تعبر بشكل واضح عن المشاعر السلبية مثل: Asano (أسانيو)، Asian (آسيوي)، movie (فيلم)، و acting (تمثيل). وهذا يوضح العيوب الكبيرة في المنطق الذي يستخدمه نموذج التنبؤ لتصنيف المفردات الواردة في نصوص التقييمات المقدمة. القسم التالي يوضح كيف أن تحسين هذا المنطق يمكن أن يطور من أداء نموذج التنبؤ إلى حد كبير.2025 - 1447--- VISUAL CONTEXT --- **GRAPH**: Local explanation for class pos Description: A horizontal bar chart showing the local explanation for a positive class prediction. It illustrates the contribution of different words (features) to the model's prediction. Red bars indicate negative contributions, and green bars indicate positive contributions. X-axis: Contribution Score Y-axis: Word (Feature) Data: The graph displays the impact of individual words on a model's prediction for the 'pos' class. Words like 'Asano', 'Asian', 'acting', and 'movie' have negative contributions (red bars), pushing the prediction away from 'pos'. Conversely, words such as 'beautifully', 'superb', 'great', 'outlook', 'solid', and 'Ichi' have positive contributions (green bars), supporting the 'pos' prediction. The length of each bar represents the magnitude of its contribution. Key Values: Asano: approx -0.28 contribution, Asian: approx -0.18 contribution, acting: approx -0.15 contribution, movie: approx -0.13 contribution, beautifully: approx 0.09 contribution, superb: approx 0.08 contribution, great: approx 0.06 contribution, outlook: approx 0.04 contribution, solid: approx 0.03 contribution, Ichi: approx 0.02 contribution Context: This visual demonstrates how a Local Interpretable Model-agnostic Explanations (LIME) model explains the prediction of a machine learning classifier by showing the individual contribution of each feature (word) to the final classification decision. It helps in understanding why a model made a specific (potentially incorrect) prediction. (Note: Some details are estimated)