Datasets, Features, Labels & Exploratory Data Analysis (EDA)
Understand rows, columns, feature types (numerical vs. categorical), target labels, and the 5-minute EDA checklist every ML engineer runs before modeling
A tabular dataset is a table where each row is one observation, input columns are Features (X), the answer column is the Label (y), and Exploratory Data Analysis (EDA) is the systematic inspection of distributions, types, missingness, and correlations before modeling.
Blindly feeding raw CSV files into a model guarantees silent bugs: ID columns masquerading as numbers, target leakage columns, 99% missing columns, or extreme skewness.
Garbage in, garbage out — 30 minutes of disciplined EDA beats 30 hours of hyperparameter tuning.
Catching schema drift, mixed types ('N/A' strings inside numeric columns), and ID leakage during EDA prevents production outages.
EDA reveals the business story: class imbalance ratios, bimodal customer groups, and high-signal domain features.
Live coding & take-home interviews explicitly grade whether you inspect data distributions and missingness before calling .fit().
Which column should almost NEVER be passed raw as a numeric feature into a Linear Regression or Random Forest?
- Identify observations (rows), features (X), and targets (y) in any tabular dataset.
- Classify every feature into Numerical (continuous/discrete), Categorical (nominal/ordinal), Datetime, or Text.
- Execute a repeatable 5-step EDA checklist: shape/types, missingness, target balance, outliers/skewness, and correlations.
- Spot 'junk' or 'leaky' columns (like user_id or cancellation_date) during EDA before they ruin your model.
Before a single equation touches your data, you need to know what every column actually represents. A dataset is not just a matrix of floats — it is a messy record of real-world processes. EDA turns a mysterious CSV into a clear map of feature types, missing gaps, skew, class balance, and potential leakage.
1. The 4 Feature Data Types (Don't Confuse Digits With Numbers!)
Imagine a spreadsheet of online orders with columns: order_id, price_usd, shirt_size (S/M/L), and country. Two of them look like numbers, two look like text — yet each requires completely different treatment!
Every column in a tabular dataset belongs to one of four families:
- Numerical — Continuous: Measurements on a real scale (
height_cm,price_usd,temperature). Math like averages and differences makes sense. - Numerical — Discrete: Whole counts (
num_clicks,bedrooms). - Categorical — Nominal (No Order): Distinct buckets with no ranking (
city,payment_method,zip_code). Needs One-Hot or Target Encoding. - Categorical — Ordinal (Ordered): Categories with a natural rank (
S < M < L < XL,Low < Medium < High). Preserving order matters!
2. The 5-Minute Beginner EDA Checklist
Think of EDA as a pilot's pre-flight checklist: skip one item and you might not notice a missing wheel until takeoff.
Run these 5 checks on every new dataset before writing any modeling code:
- Shape & Dtypes: How many rows and columns ? Are numeric columns accidentally stored as strings?
- Missing Values & Duplicates: Which columns have
NaN? Are there duplicate rows that could leak across train and test? - Target Distribution (): For classification, is it balanced (50/50) or imbalanced (99/1)? For regression, is heavily right-skewed?
- Outliers & Impossible Values: Are there negative ages (
age = -5) or sentinel codes like999999? - Correlations & Leakage Scan: Does any feature correlate with because it was recorded after the event?
Running the 5-Minute EDA Audit on a Churn Table
You receive customers.csv with 10,000 rows and 8 columns to predict churned (0/1).
You find 94% churned=0 and 6% churned=1. Immediately you know Accuracy is useless — you will track PR-AUC and Recall.
The exact honest questions almost every beginner wonders — answered in plain English without hiding behind jargon.
No! Lock away your test set first and perform all exploratory inspection, threshold discovery, and feature decisions strictly on the training split so you never overfit your intuition to test data.
Activate All 5 Pillars of a Ship-Ready ML Project
import numpy as np
# Lightweight 5-Minute EDA Audit (Pure NumPy)
# Columns: [sqft, bedrooms, age_years] | Target: price_k
X = np.array([
[1200, 2, 15],
[1850, 3, 8],
[np.nan, 4, 2],
[2400, 4, -5], # impossible negative age!
[15000, 5, 1], # extreme outlier!
], dtype=float)
y = np.array([250.0, 380.0, 490.0, 520.0, 3200.0])
names = ["sqft", "bedrooms", "age_years"]
print(f"Dataset shape: N={X.shape[0]} rows, D={X.shape[1]} features")
for j, col in enumerate(names):
vals = X[:, j]
n_missing = int(np.isnan(vals).sum())
clean = vals[~np.isnan(vals)]
print(f" {col:10s} | missing={n_missing} | min={clean.min():.1f} | median={np.median(clean):.1f} | max={clean.max():.1f}")
print(f"Target y -> mean={y.mean():.1f}, median={np.median(y):.1f} (mean >> median signals right skew!)")
XGBClassifier().fit(X, y) without checking missing values, target skew, or ID columns.price has median = $45 and mean = $1,820. What does this immediately tell you during EDA?