Skip to content
Handbook navigation

Full-access lesson

Logistic Regression

On the Wisconsin breast-cancer measurements that ship with scikit-learn, 569 tumours with 30 numbers each, LogisticRegression() estimates the probability that a tumour is malignant with 97.9% five-fold cross-validated accuracy and a log loss of 0.074, the features standardised inside a pipeline. That default includes a penalty nobody asked for. Switch it off with penalty=None and the solver stops at its 100-iteration limit with a ConvergenceWarning. Allow it 100,000 iterations and it reports success, with every training tumour classified correctly and a weight vector 27,225 units long. Cross-validate an almost unpenalised model (C=10000) and the held-out log loss is 1.03, fourteen times the default's, although accuracy has fallen only three points.

The complete curriculum

All 12 volumes, companion resources, interviews, and architecture reviews.

Executable engineering practice

Subscriber-only Python, Java, TypeScript, and SQL labs in the isolated runner.

Logistic Regression | KnowledgeOS