اختيار المكوّنات باستخدام مخططات Scree
الاحتفاظ بتباين مفسَّر كافٍ
اختيار المكوّنات باستخدام مخططات Scree درس مجاني في Data Science Academy على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Data Science Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Data Science Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
How Many to Keep?
PCA can hand you dozens of components, but you only want the useful few. The real skill is choosing how many to keep.
Meet the Scree Plot
A scree plot charts each component against the variance it explains, so you can see importance drop off at a glance.
Look for the Elbow
Variance falls fast then levels into a flat tail. The bend, called the elbow, marks where extra components stop paying off.
Plot the Ratios
Fit PCA with all components, then plot explained_variance_ratio_ to draw the curve and spot that elbow.
import matplotlib.pyplot as plt
plt.plot(pca.explained_variance_ratio_)Cumulative Variance
Add the ratios up as you go to get cumulative variance, showing the total information kept by the first k components.
import numpy as np
cum = np.cumsum(pca.explained_variance_ratio_)Pick a Threshold
A common rule is to keep enough components to reach a target, like 95 percent of total variance retained.
Let scikit-learn Choose
Pass a fraction as n_components and scikit-learn keeps just enough components to hit that explained-variance target.
from sklearn.decomposition import PCA
pca = PCA(n_components=0.95).fit(X)The Kaiser Rule
Another guide, the Kaiser rule, keeps components whose eigenvalue exceeds one, meaning they explain more than a single feature would.
Balance the Trade-Off
Fewer components mean simpler, faster models but more lost detail. Choosing k is always a trade-off between size and fidelity.
Validate Downstream
The best k is the one that helps your real task. Try a few values and compare model scores with cross-validation.
Beware Tiny Components
Components past the elbow often capture mostly noise. Keeping them rarely helps and can quietly hurt your model.
Quick Check
The scree plot points you to one telltale spot.
Recap
Use a scree plot, elbow, or a cumulative-variance threshold to keep just enough components, then validate k downstream. 🎯
الأسئلة الشائعة
هل درس «اختيار المكوّنات باستخدام مخططات Scree» مجاني؟
نعم — نص درس «اختيار المكوّنات باستخدام مخططات Scree» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Data Science Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Data Science Academy 4 دروس في المجموع.
ماذا ستتعلم في «اختيار المكوّنات باستخدام مخططات Scree»؟
الاحتفاظ بتباين مفسَّر كافٍ تتمرن على Data Science Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Data Science Academy؟
لا تُشترط خبرة سابقة. Data Science Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.
كم من الوقت يستغرق درس «اختيار المكوّنات باستخدام مخططات Scree»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Data Science Academy هذا؟
نعم. كل درس في Data Science Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- لعنة كثرة الميزات
- كيف يعثر PCA على المكوّنات
- حجّم البيانات أولًا ثم طبّق PCA
- اختيار المكوّنات باستخدام مخططات Scree