0Pricing
Data Science Academy · درس

الميزات X والهدف y

تهيئة المدخلات بالشكل الذي تتوقعه المكتبة

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

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

Inputs and Outputs

Supervised models learn a mapping from inputs to an output. The inputs are your features, and the output is what you want to predict. 🎯

Meet X and y

By convention, features go in a capital X and the target goes in a lowercase y. This naming shows up in nearly every example you read.

X Is Two-Dimensional

Capital X is a 2D table: one row per sample, one column per feature. scikit-learn always expects this rows-by-columns shape.

X.shape  # (n_samples, n_features)

y Is One-Dimensional

The target y is usually a single column: one value per sample. Its length must match the number of rows in X exactly.

y.shape  # (n_samples,)

Split a DataFrame

From a pandas table, you carve out X and y by selecting columns. The target column becomes y; everything else becomes X.

X = df.drop(columns=['price'])
y = df['price']

Features Should Be Numeric

Most estimators expect numeric features. Text and category columns need encoding into numbers before they can enter X.

Keep the Target Out of X

Never leave the answer inside your features. A target hiding in X is leakage, and it makes a model look perfect but useless.

Rows Must Line Up

Row one of X must correspond to value one of y. This alignment is how the model connects each sample to its correct answer.

Regression vs Classification

If y holds continuous numbers it is regression; if y holds categories it is classification. The target's type decides the model family.

Feed Both Into fit

Once X and y are ready, you hand both to fit together. The model reads features and answers side by side to learn.

model.fit(X, y)

predict Takes X Only

When predicting, you pass new features with the same columns as training X. You never pass y, since that is what you want back.

model.predict(X_new)

Quick Check

Make sure you have the shapes of X and y straight.

Recap

Split your data into X, a 2D feature table, and y, the 1D target. Keep them aligned and leak-free, and fit is ready to learn. ✅

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

هل درس «الميزات X والهدف y» مجاني؟

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

ماذا ستتعلم في «الميزات X والهدف y»؟

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

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

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

كم من الوقت يستغرق درس «الميزات X والهدف y»؟

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

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

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

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

  1. عقد fit وpredict
  2. الميزات X والهدف y
  3. تدريب انحدار خطي
  4. قيّم نموذجك الأول
← العودة إلى Data Science Academy