0Pricing
Data Science Academy · Lektion

Merkmale X und Zielgröße y

Eingaben in die von der Bibliothek erwartete Form bringen

Merkmale X und Zielgröße y ist eine kostenlose Data Science Academy-Lektion auf CoddyKit. Dies ist Lektion 2 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Data Science Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Data Science Academy-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

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. ✅

Häufig gestellte Fragen

Ist die Lektion „Merkmale X und Zielgröße y“ kostenlos?

Ja — der vollständige Text von „Merkmale X und Zielgröße y“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Data Science Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Data Science Academy-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „Merkmale X und Zielgröße y“?

Eingaben in die von der Bibliothek erwartete Form bringen Du übst Data Science Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.

Brauche ich Erfahrung, um Data Science Academy zu starten?

Keine Vorkenntnisse erforderlich. Data Science Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 2 von 4.

Wie lange dauert die Lektion „Merkmale X und Zielgröße y“?

Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.

Kann ich in dieser Data Science Academy-Lektion Code schreiben und ausführen?

Ja. Jede Data Science Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.

Alle Lektionen in diesem Kurs

  1. Der fit- und predict-Vertrag
  2. Merkmale X und Zielgröße y
  3. Eine lineare Regression trainieren
  4. Ihr erstes Modell bewerten
← Zurück zu Data Science Academy