Skip to content

Fix linear selection on Python 3.12 - #25

Open
russlan23 wants to merge 1 commit into
fidelity:masterfrom
russlan23:fix/python-312-linear-selection
Open

Fix linear selection on Python 3.12#25
russlan23 wants to merge 1 commit into
fidelity:masterfrom
russlan23:fix/python-312-linear-selection

Conversation

@russlan23

Copy link
Copy Markdown

Fixes #24.

scikit-learn removed the multi_class parameter from LogisticRegression. This keeps the existing liblinear one-vs-rest behavior by wrapping the two logistic estimators in OneVsRestClassifier, then preserves the existing coefficient aggregation when computing feature scores.

Validation:

  • Python 3.12.6 / scikit-learn 1.9.0: none, lasso, and ridge classification paths fit and transform successfully on Iris
  • Python 3.11.10 / scikit-learn 1.5.2: the new unregularized scores match the legacy implementation exactly
  • Python compile check and git diff check pass

Signed-off-by: russlan23 <rrusslanjr@gmail.com>
@russlan23
russlan23 requested a review from skadio as a code owner August 26, 2026 16:36
@skadio
skadio requested review from rbaral and takojunior August 26, 2026 16:55
@skadio

skadio commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

@russlan23 thank you so much for this PR and the fix. Coincidently, we were also just in the middle of updating this specific issue. Please stay tuned for an update shortly. We might use this PR (or, close this one and make an version upgrade internally). Either way, this is going to be fixed very soon. cc: @rbaral @takojunior

@rbaral

rbaral commented Aug 27, 2026

Copy link
Copy Markdown

@russlan23 thanks for the suggestion you provided. This and with some other minimal fix in text_based.py (for upgraded pandas due to Python 3.12), I was able to run the test cases for Python 3.12. and Python 3.10. I can bundle these two fixes and some housekeeping work into a new PR. We also need to add some documentation about the fix.

It would have been better to have minimal code changes, such as using a different solver. However, that required some changes in the test cases. CC @skadio @takojunior

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.

Linear Selection Method fails with Python 3.12

3 participants