Skip to content

HW4 (2026): Q5 std 0.013 vs 0.007 — solver must be liblinear - #483

Open
marcos-Nieves-24 wants to merge 1 commit into
DataTalksClub:mainfrom
marcos-Nieves-24:faq/hw4-q5-solver-std
Open

marcos-Nieves-24 wants to merge 1 commit into
DataTalksClub:mainfrom
marcos-Nieves-24:faq/hw4-q5-solver-std

Conversation

@marcos-Nieves-24

Copy link
Copy Markdown

New FAQ entry for machine-learning-zoomcamp / module-4-homework.

Students hitting Q5 with the bare LogisticRegression(max_iter=1000) constructor get std 0.013 (lbfgs default + ConvergenceWarning) instead of the correct 0.007 (solver='liblinear'). Fix-first answer with runnable per-fold code, verified against the pinned 2026 homework: https://github.com/DataTalksClub/machine-learning-zoomcamp/blob/main/cohorts/2026/homework/04-evaluation/homework.md

New entry in module-4-homework: the spec requires solver='liblinear'; the lbfgs default warns and lands on the wrong option.
@saeidsoheily

saeidsoheily commented Oct 21, 2026 •

Copy link
Copy Markdown

You should explicitly set solver='liblinear' when creating your Logistic Regression model (The default solver is lbfgs).

# Incorrect: uses the default lbfgs solver
model = LogisticRegression(max_iter=1000)

# Correct: required by the 2026 homework
model = LogisticRegression(
    solver='liblinear',
    C=1.0,
    max_iter=1000
)

The [official ML Zoomcamp 2026 Module 4 homework] explicitly requires solver='liblinear', C=1.0, and max_iter=1000 for Question 5.

The difference matters because lbfgs and liblinear use different optimization algorithms. On this dataset, they can produce different model coefficients, predictions, and ROC AUC scores.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants