One split matters
Your model learns from features and tries to predict one label. In scikit-learn code, features are usually named X and the label is usually named y.
X must not contain the answer column. If it does, your model may look perfect in college demo day and fail on real data.
Features and label
A feature is an input column. Example: hours_studied, attendance_percent, past_score. A label is the target column. Example: pass_fail.
For a builder project, write this clearly in your README later: “I used these columns as features, and this column as the label.”
Prepare the table
Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.
0 of 5 done
Avoid label leakage
Label leakage means the features include information you would not have when making a real prediction.
Example: predicting loan default using a column called final_recovery_amount is leakage, because that value is only known after the loan goes bad.
Create X and y
This example uses a small student dataset. It predicts pass_fail from study and attendance columns.
Keep the target out of X. Drop ID-like columns unless they contain real signal you can explain.
import pandas as pd
# Load data
df = pd.read_csv("data/students.csv")
# Quick check
print(df.head())
print(df.isna().sum())
# Simple cleanup
# Fill missing numeric values with the column median
df["hours_studied"] = df["hours_studied"].fillna(df["hours_studied"].median())
df["attendance_percent"] = df["attendance_percent"].fillna(df["attendance_percent"].median())
# Convert a text category into numbers
# yes -> 1, no -> 0
df["has_internet"] = df["has_internet"].map({"yes": 1, "no": 0})
# Choose label
y = df["pass_fail"]
# Choose features
X = df.drop(columns=["pass_fail", "student_id", "final_marks"])
print("Feature columns:", list(X.columns))
print("Label column: pass_fail")
print("X shape:", X.shape)
print("y shape:", y.shape)Use AI carefully
You can ask ChatGPT or Gemini: “Given these columns, which should be features and which should be the label for predicting pass_fail?” Paste only column names, not private student data.
Check the answer yourself. Remove columns that reveal the result, IDs, names, phone numbers, emails, and anything collected after the prediction moment.
Write choices down
Good ML repos explain boring choices. That is what makes them internship-ready.
Add a short note in your notebook or README draft: dataset source, label column, feature columns, removed columns, and missing-value handling.
Do this now
Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.
0 of 5 done