0Pricing
Data Science Academy · درس

أهمية الميزات وSHAP

ما اعتمد عليه النموذج أكثر من غيره

أهمية الميزات وSHAP درس مجاني في Data Science Academy على CoddyKit. هذا هو الدرس 1 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Data Science Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Data Science Academy 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Which Features Mattered?

After a model trains, you want to know which inputs drove its predictions. That ranking is called feature importance. 🔍

Built-In Tree Importance

Tree models expose a quick feature_importances_ array. Higher values mean the feature was used more often to split the data.

importances = model.feature_importances_

Pair It With Names

The importances array is just numbers, so zip it with your column names to read which feature each score belongs to.

import pandas as pd
fi = pd.Series(model.feature_importances_, index=X.columns)

Sort to See Top Drivers

Sorting the importance Series surfaces the few features that carry most of the signal in your model.

fi.sort_values(ascending=False).head()

The Catch With Trees

Built-in tree scores can favor high-cardinality columns. They tell you usage, not always real impact on predictions.

Permutation Importance

A fairer, model-agnostic method is permutation importance: shuffle one column and measure how much the score drops.

from sklearn.inspection import permutation_importance
r = permutation_importance(model, X_test, y_test)

Enter SHAP

For per-prediction detail you use SHAP values, which fairly split each prediction among the features that produced it.

SHAP Is Game Theory

SHAP borrows from game theory: each feature is a player, and its value is the credit it earns toward one specific prediction.

Compute SHAP Values

You build an explainer for your fitted model, then ask it for SHAP values on the rows you care about.

import shap
explainer = shap.Explainer(model)
values = explainer(X_test)

Global From Local

Average the absolute SHAP values across all rows and you get a trustworthy global importance ranking, built from local explanations.

shap.plots.bar(values)

Explain One Prediction

SHAP also shows why a single row scored as it did, listing which features pushed the prediction up and which pulled it down.

shap.plots.waterfall(values[0])

Quick Check

Which method gives a fair, model-agnostic importance score?

Recap

You ranked features with tree, permutation, and SHAP methods, moving from quick scores to fair, per-prediction credit. Next, how one feature moves output. 🎯

الأسئلة الشائعة

هل درس «أهمية الميزات وSHAP» مجاني؟

نعم — نص درس «أهمية الميزات وSHAP» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Data Science Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Data Science Academy 4 دروس في المجموع.

ماذا ستتعلم في «أهمية الميزات وSHAP»؟

ما اعتمد عليه النموذج أكثر من غيره تتمرن على Data Science Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Data Science Academy؟

لا تُشترط خبرة سابقة. Data Science Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 1 من أصل 4.

كم من الوقت يستغرق درس «أهمية الميزات وSHAP»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Data Science Academy هذا؟

نعم. كل درس في Data Science Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. أهمية الميزات وSHAP
  2. الفكرة الحدسية للاعتماد الجزئي
  3. مخططات تقنع أصحاب المصلحة
  4. من Notebook إلى Dashboard
← العودة إلى Data Science Academy