Skip to content

Conversation

@lionelkusch
Copy link
Collaborator

@lionelkusch lionelkusch commented Aug 28, 2025

Add the method for FDR and the test associate test for these two methods.
Fix bug in selection

@codecov
Copy link

codecov bot commented Aug 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.43%. Comparing base (7d642a4) to head (f10bf06).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #361      +/-   ##
==========================================
+ Coverage   97.87%   99.43%   +1.56%     
==========================================
  Files          22       22              
  Lines        1223     1247      +24     
==========================================
+ Hits         1197     1240      +43     
+ Misses         26        7      -19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@bthirion bthirion left a comment

Choose a reason for hiding this comment

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

fdr control should be based on p-values or e-values only.
LGTM otherwise.

@lionelkusch lionelkusch added the API 2 Refactoring following the second version of API label Sep 9, 2025
Copy link
Collaborator

@bthirion bthirion left a comment

Choose a reason for hiding this comment

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

oops, I had a few comments not pushed yet. HTH.

@lionelkusch lionelkusch requested a review from bthirion October 2, 2025 17:13
Copy link
Collaborator

@bthirion bthirion left a comment

Choose a reason for hiding this comment

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

Just started a pass.

Copy link
Collaborator

@bthirion bthirion left a comment

Choose a reason for hiding this comment

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

Thx for taking care of that.
I have a few simplications suggestions.

Selects features with importance scores above the specified threshold.
threshold_pvalue : float, optional, default=None
Selects features with p-values below the specified threshold.
threshold_max : float, default=None
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure whether this argument really makes sense ?
I think I would have a unique threshold argument for this function.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's because sometimes, we want to have the maximum or the minimum.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

see issue ##481

Selects features based on a specified percentile of p-values.
threshold_max : float, default=0.05
Selects features with p-values below the specified maximum threshold (0 to 1).
threshold_min : float, default=None
Copy link
Collaborator

Choose a reason for hiding this comment

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

similarly, I don't see any use case for threshold_min here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The first idea is to propose a generic way of selection.
My first idea of using it is to have a selecting the feature to discard.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

see issue ##481

Selects features with p-values below the specified maximum threshold (0 to 1).
threshold_min : float, default=None
Selects features with p-values above the specified minimum threshold (0 to 1).
alternative_hypothesis : bool, default=False
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't see the use case for alternative hypothesis.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was present in the EnCluDL, I add the option for keeping the same possibilities.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

see issue ##481

reshaping_function: callable or None, default=None
Optional reshaping function for FDR control methods.
If None, defaults to sum of reciprocals for 'bhy'.
alternative_hippothesis: bool or None, default=False
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same thing here, I don't see any reason to consider an alternative hypothesis. This is because importance tests are all one-sided tests that test whether importance is greater 0 (=significantly different from 0, in that case).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was present in the EnCluDL, I add the option for keeping the same possibilities.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, but there are good reasons for that: EncluDL yields a signed statistic, not dCRT.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

see issue ##481

random_state=None,
reuse_screening_model=True,
k_best=None,
k_lowest=None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

k_lowest is hard to interpret: it only makes sense because we're considering p-values.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Users won't use it if they can't interpret.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For DCRT, only pvalue is considered.

Copy link
Collaborator

@jpaillard jpaillard left a comment

Choose a reason for hiding this comment

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

Looks almost ready.

  • I agree with the comments regarding simplifying the signature of selection functions.
  • I suggest simplifying the smoke test: one test per function with multiple asserts to explore branching seems enough to me and would cut duplicated code.
  • It would be good to add an example illustrating how to use the new functions. No need to do it here, but could you open an issue for that?

[0, 2],
ids=["default_seed", "another seed"],
)
class TestSelection:
Copy link
Collaborator

Choose a reason for hiding this comment

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

The tests in this class are smoke tests and have a lot of duplicated code. I think it would be ok to gather all the smoke tests that explore the different selections in one test, or maybe 2 to separate importance_selection and p_value_selection.

Copy link
Collaborator Author

@lionelkusch lionelkusch Oct 10, 2025

Choose a reason for hiding this comment

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

There are not smoke tests because they test the result directly, the values into the array and not only the shape.

It's better to have only one assertion by test. This type of test is a call unit test and they shouldn't be gathered. To group them, I use classes for it.
I don't see the duplication of the code. Each test, test one specific parameter.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

see issue #483

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it would also be good to have a "behaviour test" with simulated data.
Ideally, in high dimensions, with a method that is not computationally costly, to show that it reduces the number of false discoveries.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In issue #375, the "behaviour tests", also call system test/user acceptance test, were not defined for the moment.
I will open an issue in regard to it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

see issue #484

@lionelkusch lionelkusch merged commit 894ff9d into mind-inria:main Oct 10, 2025
24 checks passed
@lionelkusch lionelkusch deleted the PR_selection branch October 10, 2025 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API 2 Refactoring following the second version of API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants