0Pricing
Data Science Academy · درس

انحدار شجرة القرار

تقسيمات غير خطية للبيانات

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

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

Beyond Straight Lines

A decision tree predicts numbers by asking yes-or-no questions about your features, splitting the data step by step. No straight line required. 🌳

Splits Are the Questions

Each branch is a split, like is size above 80? The tree keeps asking, narrowing rows into smaller and smaller groups.

Leaves Hold the Answer

At the bottom sit the leaves. Each leaf predicts one number: the average target of all training rows that landed there.

Choosing the Best Split

The tree tries many split points and keeps the one that most reduces prediction error in the resulting groups. Greedy, one step at a time.

Train One in Two Lines

The familiar fit-predict contract holds. Create a DecisionTreeRegressor, fit it, and predict just like any other estimator.

from sklearn.tree import DecisionTreeRegressor
model = DecisionTreeRegressor().fit(X, y)

Predictions Look Like Steps

Because each leaf gives one flat value, a tree's predictions form a staircase, not a smooth curve. That is fine for many real patterns.

Trees Catch Non-Linear Shapes

Splits can bend any direction, so a tree captures non-linear relationships that a line would completely miss. That is its real strength.

Deep Trees Overfit

Left unchecked, a tree grows until each leaf holds one row, memorizing noise. That deep tree overfits and fails on new data.

Limit the Depth

Control growth with max_depth. A shallower tree stays general and is far easier to read and trust.

DecisionTreeRegressor(max_depth=4)

More Pruning Knobs

You can also set min_samples_leaf so leaves keep enough rows. This stops the tree from carving out tiny, noisy groups.

DecisionTreeRegressor(min_samples_leaf=10)

No Scaling Needed

Trees split on thresholds, so feature units do not matter. You can skip scaling, a nice contrast to Ridge and Lasso.

Quick Check

Think about how a tree turns rows into a prediction.

Recap

A decision tree splits data with questions, predicts a leaf average, and bends to non-linear shapes. Cap its depth so it generalizes. 🎯

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

هل درس «انحدار شجرة القرار» مجاني؟

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

ماذا ستتعلم في «انحدار شجرة القرار»؟

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

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

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

كم من الوقت يستغرق درس «انحدار شجرة القرار»؟

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

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

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

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

  1. مراجعة الانحدار الخطي
  2. انتظام Ridge وLasso
  3. انحدار شجرة القرار
  4. الغابة العشوائية للانحدار
← العودة إلى Data Science Academy