Skip to content

Feature solver - #26

Open
rbaral wants to merge 3 commits into
masterfrom
feature_solver
Open

Feature solver#26
rbaral wants to merge 3 commits into
masterfrom
feature_solver

Conversation

@rbaral

@rbaral rbaral commented Sep 4, 2026

Copy link
Copy Markdown

Context:
This PR provides the solution to the issue Linear Selection Method fails with Python 3.12 (#24). The issue is about the Linear selection failing because the scikit-learn does not support multi_class attribute for LogisticRegression

Traceback (most recent call last):
  File "/home/rbaral/Documents/projects/selective/sample.py", line 13, in <module>
    selector = Selective(SelectionMethod.Linear(num_features=3, regularization="none"))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rbaral/Documents/projects/selective/feature/selector.py", line 532, in __init__
    self._imp = _Linear(self.seed, self.selection_method.num_features,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rbaral/Documents/projects/selective/feature/linear.py", line 32, in __init__
    "classification_none": LogisticRegression(random_state=self.seed,
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: LogisticRegression.__init__() got an unexpected keyword argument 'multi_class'

See more context and replication steps at #24

Fix:

  1. In feature/linear.py, inside __init__() method, use the OneVsRestClassifier to wrap the LogisticRegression and remove the multi_class attribute.
  2. In text_based.py, update the way the Label matrix is defined inside process_category_data() method

@takojunior @kuppulur @skadio @wddcheng Can you please help with the PR review?

@rbaral
rbaral requested a review from skadio as a code owner September 4, 2026 04:33
@wddcheng

wddcheng commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

LGTM!

@skadio skadio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking if this approval works/possible.

@skadio

skadio commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

(let me know if you need help in updating pypi)

@rbaral

rbaral commented Sep 10, 2026

Copy link
Copy Markdown
Author

(let me know if you need help in updating pypi)

@skadio thanks for offering to help. Please feel free to proceed.

@takojunior takojunior left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @rbaral ! PR looks good to me. Please also update the changelog and the version. It might be a version 1.3.0? This is where version is applied feature/_version.py when install.

Comment thread feature/linear.py

This method identifies the appropriate model context (regression vs. classification),
fits it to the training data, and extracts the coefficient weights. For multi-class
classifiers, it computes a global score by averaging the class-specific absolute weights.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the notes!

@takojunior

Copy link
Copy Markdown
Member

Thank you @rbaral ! PR looks good to me. Please also update the changelog and the version. It might be a version 1.3.0?

@takojunior takojunior closed this Sep 10, 2026
@takojunior takojunior reopened this Sep 10, 2026
@rbaral

rbaral commented Sep 11, 2026

Copy link
Copy Markdown
Author

@skadio @takojunior It looks like I do not have upload access. I updated the changelog and upgraded version to 1.2.1. Can you help with uploading to pypi?

@takojunior

Copy link
Copy Markdown
Member

@skadio @takojunior It looks like I do not have upload access. I updated the changelog and upgraded version to 1.2.1. Can you help with uploading to pypi?

I have the maintainer role for selective on pypi. I should be able to help upload to pypi if ok. @skadio @rbaral

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.

4 participants