Session 8: sklearn in Practice
Common Error #1: Shape Mismatches
X = [1, 2, 3, 4, 5]
model.fit(X, y)
X = [[1], [2], [3], [4], [5]]
model.fit(X, y)
Rule: X is always 2D (samples × features), y is always 1D
Always print shapes when debugging:
print(f"X: {X.shape}, y: {y.shape}")