scikit-learn / scikit-learn/scikit-learn

Change forcing sequence in newton-cg solver of LogisticRegression

Open
#30,160 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

New Feature Performance
Dominant language
Python
Stars
67.3k
Forks
27.4k
Avg merge
1d 15h
Merged PRs (30d)
58

Description

Describe the workflow you want to enable

I'd like to have faster convergence of the "newton-cg" solver of LogisticRegression based on scientific publications with empirical studies as done in A Study on Truncated Newton Methods for Linear Classification (2022) (free pdf version).

Describe your proposed solution

It is about the inner stopping criterion in a truncated Newton solver, i.e. when should the inner solver for "hessian @ coefficients = -gradient" stop.

$eta = \eta$ is the forcing sequence.

Current stopping criterion

$residual ratio = \frac{\rVert res\lVert_1}{\rVert grad \lVert_1} \leq \eta$ with $res = residual = grad - hess @ coef$ and $\eta = \min([0.5, \sqrt{\rVert grad \lVert_1]})$ (this eta is called adaptive forcing sequence.

Proposed stopping criterion

As recommended by Chapter VII.

  • Replace residual ratio with the quadratic approximation ratio $j\frac{Q_j - Q_{j-1}}{Q_j}$ and $Q_j = grad @ coef_j + \frac{1}{2} coef_j^T @ hessian @ coef_j$ and $j$ is the inner iteration number.
  • Optionally replace L1-norm by L2-norm. For the quadratic ratio, this does not matter much.
Describe alternatives you've considered, if relevant

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the LogisticRegression implementation of the "newton-cg" solver and trace the inner stopping criterion for the Hessian-and-gradient solve. Compare the current adaptive forcing sequence with the quadratic approximation ratio in the cited paper, then identify or add solver tests that establish convergence behavior and the selected norm before considering the change complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.