You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Homework 4 (2026) Q5 std mismatch — 0.013 instead of 0.007 (solver must be liblinear) #482
Why does my Homework 4 (2026) Q5 cross-validation std not match any option — I get 0.013 instead of 0.007?
Answer
Fix first — copy the model constructor exactly as the homework specifies:
KFold(n_splits=5,shuffle=True, random_state=1)
# per fold, with a fresh DictVectorizer fit on the train fold only:model=LogisticRegression(solver='liblinear', C=1.0, max_iter=1000)
The bare constructor LogisticRegression(max_iter=1000) silently uses the default solver lbfgs. On the 2026 lead-scoring data it throws ConvergenceWarning: lbfgs failed to converge and produces fold AUCs ~[0.776, 0.787, 0.799, 0.811, 0.780] with std 0.013 — a different multiple-choice option. With solver='liblinear' the folds are ~[0.731, 0.730, 0.736, 0.741, 0.721] with std 0.007, the correct answer. Same data, same seed, wrong solver, wrong answer.
Why this happens:
lbfgs and liblinear optimize differently on unscaled one-hot features, so they converge to different weights and therefore different per-fold AUCs. The warning in your output is the tell: if you see ConvergenceWarning in Q5, your solver is wrong. Related trap in the same notebook: Q1 must exclude converted itself from the single-variable AUC loop (it scores 1.000 against itself and answers nothing).
Activity
marcos-Nieves-24 commentedon Oct 19, 2026
Superseded by PR #483 with the entry in the repo's _questions format.