Part 06 / Topic 7 of 7
Regularization
Regularization penalises large weights, pulling the model toward simpler fits. L2 shrinks all weights smoothly; L1 drives some exactly to zero (built-in feature selection). In LogisticRegression the knob is C — inverse strength, so smaller C = more regularization.
Measured on a deliberately nasty case (120 samples, 60 features):
C=100.0 train=1.000 test=0.767
C=1.0 train=1.000 test=0.767
C=0.01 train=0.917 test=0.800
Strong regularization gave up 8 points of training accuracy and gained 3 on test — it traded memorisation for generalisation. Tune C with cross-validation (Part 8), never on the test set.
Done here? The practice set for Part 6 — 4 exercises with solutions — is on the part page.