What does C control in scikit-learn's LogisticRegression, and why is its inverse link to regularization confusing?

Quick Overview

Explain what the C parameter of scikit-learn's LogisticRegression controls and why its inverse relationship to regularization strength confuses practitioners. Tests the regularized objective, the bias-variance effect of C, feature scaling, and how to tune it.

What does C control in scikit-learn's LogisticRegression, and why is its inverse link to regularization confusing?

Role: Data Scientist

Category: Machine Learning

Difficulty: easy

Interview Round: Other

In scikit-learn's `LogisticRegression`, what does the `C` parameter control, and why does its inverse relationship to regularization strength trip people up? ```hint Write out the objective Write down the loss scikit-learn minimizes for logistic regression and look at which term `C` multiplies. ``` ### What a Strong Answer Covers - Which term of the objective `C` multiplies, and how it maps to the textbook regularization parameter - What small and large values of `C` do to the coefficients and to the bias-variance trade-off - Why the convention confuses people, including how other estimators in the same library are parameterized - Practical tuning: a log-scale search, feature scaling, and the fact that a penalty is applied by default ### Follow-up Questions - With an L1 penalty, what happens to the coefficients as you decrease `C`? - You fit the same model with `C=1` on 1,000 rows and on 1 million rows. Is the regularization equally strong in both fits? - Why might the coefficients from a default scikit-learn fit differ from an unpenalized logistic regression in statsmodels on the same data? - How would you choose `C`, and which metric would you tune it on?

Overview: Explain what the C parameter of scikit-learn's LogisticRegression controls and why its inverse relationship to regularization strength confuses practitioners. Tests the regularized objective, the bias-variance effect of C, feature scaling, and how to tune it.

PracHub logo
General
Nov 24, 2026
easyData ScientistOtherMachine Learning
0
0

In scikit-learn's LogisticRegression, what does the C parameter control, and why does its inverse relationship to regularization strength trip people up?

What a Strong Answer Covers Guidance

  • Which term of the objective C multiplies, and how it maps to the textbook regularization parameter
  • What small and large values of C do to the coefficients and to the bias-variance trade-off
  • Why the convention confuses people, including how other estimators in the same library are parameterized
  • Practical tuning: a log-scale search, feature scaling, and the fact that a penalty is applied by default

Follow-up Questions Guidance

  • With an L1 penalty, what happens to the coefficients as you decrease C ?
  • You fit the same model with C=1 on 1,000 rows and on 1 million rows. Is the regularization equally strong in both fits?
  • Why might the coefficients from a default scikit-learn fit differ from an unpenalized logistic regression in statsmodels on the same data?
  • How would you choose C , and which metric would you tune it on?