Skip to content

[API 2]: CFI, PFI, LOCO#372

Merged
jpaillard merged 92 commits intomind-inria:mainfrom
lionelkusch:PR_CFI
Nov 8, 2025
Merged

[API 2]: CFI, PFI, LOCO#372
jpaillard merged 92 commits intomind-inria:mainfrom
lionelkusch:PR_CFI

Conversation

@lionelkusch
Copy link
Copy Markdown
Collaborator

Update the model of CFI, PFI and LOCO for API 2.

@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 2, 2025

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #372      +/-   ##
==========================================
+ Coverage   98.94%   99.06%   +0.12%     
==========================================
  Files          23       21       -2     
  Lines        1424     1393      -31     
==========================================
- Hits         1409     1380      -29     
+ Misses         15       13       -2     

☔ 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
Copy Markdown
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.

It looks good but the diff seems very large for this small change.
Is there a reason for all the other modifications?

@lionelkusch
Copy link
Copy Markdown
Collaborator Author

I reorganize a bit the parameter in the init and move the docstring to the class because in all the other classes, I plan to do this.

By looking into more details, I miss some parts being added. I will add it and ask you to review it after. Sorry for it.

Copy link
Copy Markdown
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.

This PR is definitely an improvement, thx.

Comment thread src/hidimstat/base_perturbation.py Outdated
Comment thread src/hidimstat/base_perturbation.py Outdated
Comment thread src/hidimstat/conditional_feature_importance.py Outdated
Comment thread src/hidimstat/conditional_feature_importance.py Outdated
Comment thread src/hidimstat/conditional_feature_importance.py
Comment thread src/hidimstat/conditional_feature_importance.py
Comment thread src/hidimstat/leave_one_covariate_out.py
Comment thread src/hidimstat/leave_one_covariate_out.py
Comment thread src/hidimstat/permutation_feature_importance.py
Comment thread src/hidimstat/permutation_feature_importance.py
Comment thread src/hidimstat/base_perturbation.py Outdated
Comment thread src/hidimstat/base_perturbation.py Outdated
Comment thread src/hidimstat/conditional_feature_importance.py Outdated
Comment thread src/hidimstat/conditional_feature_importance.py
Comment thread src/hidimstat/conditional_feature_importance.py Outdated
Comment thread src/hidimstat/conditional_feature_importance.py Outdated
Copy link
Copy Markdown
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 the progress. Please find a few suggestions enclosed.

Comment thread src/hidimstat/base_perturbation.py Outdated
Comment thread src/hidimstat/base_perturbation.py Outdated
Comment thread src/hidimstat/leave_one_covariate_out.py
Comment thread test/test_permutation_feature_importance.py Outdated
Comment thread test/test_permutation_feature_importance.py Outdated
Comment thread test/test_permutation_feature_importance.py Outdated
Comment thread src/hidimstat/base_perturbation.py Outdated
Co-authored-by: Joseph Paillard <joseph.paillard@inria.fr>
Copy link
Copy Markdown
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.

No further comment than those raised by @jpaillard

@jpaillard
Copy link
Copy Markdown
Collaborator

Regarding the statistical test, the current issue is that the cross-validation scheme has not yet been implemented. Currently, the statistical test is performed using a single train/test split. In that case, when considering the loss values for each individual sample of the test set, they can be considered as independent and we could use ttest instead of nb-ttest as the default.

The NB-t-test actually needs to be the default when CV is used, and losses over test sets cannot be considered as independent.

The comment regarding the nb-ttest implementation remains valid; however, the test fraction shouldn't be hardcoded. I will follow up on #449

@jpaillard
Copy link
Copy Markdown
Collaborator

  • I made 'ttest' as the default statistical_test for the current implem of CFI, which doesn't use CV.
  • We can keep the implementation of nb-ttest. I fixed the hardcoded test_frac. 'nb-ttest' will be the default statistical_test for LOCO_CV, CFI_CV ... in Cross Validation #449

Let me know if that's good for you. Sorry for the confusion.

@jpaillard
Copy link
Copy Markdown
Collaborator

If my last two comments are OK for you, @bthirion, this is ready to merge.
It's otherwise blocking #449

@lionelkusch
Copy link
Copy Markdown
Collaborator Author

@jpaillard I let you deal with this PR.

@lionelkusch lionelkusch mentioned this pull request Oct 27, 2025
5 tasks
@jpaillard jpaillard changed the title API 2: CFI, PFI, LOCO [API 2]: CFI, PFI, LOCO Nov 6, 2025
@jpaillard
Copy link
Copy Markdown
Collaborator

I take the opportunity to rename the function loco --> loco_analysis as discussed in #499

@jpaillard jpaillard requested a review from bthirion November 6, 2025 09:04
Copy link
Copy Markdown
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.

Very minor stuff pending. Thx !

Comment thread src/hidimstat/_utils/utils.py Outdated
Comment thread src/hidimstat/_utils/utils.py
Comment thread src/hidimstat/leave_one_covariate_out.py
Comment thread src/hidimstat/conditional_feature_importance.py
Comment thread src/hidimstat/conditional_feature_importance.py
Comment thread src/hidimstat/leave_one_covariate_out.py
Comment thread src/hidimstat/permutation_feature_importance.py
jpaillard and others added 2 commits November 7, 2025 08:38
Co-authored-by: bthirion <bertrand.thirion@inria.fr>
@jpaillard
Copy link
Copy Markdown
Collaborator

Sorry again for the confusion regarding the default test. I explained the choice a few comments above.

Regarding the statistical test, the current issue is that the cross-validation scheme has not yet been implemented. Currently, the statistical test is performed using a single train/test split. In that case, when considering the loss values for each individual sample of the test set, they can be considered as independent and we could use ttest instead of nb-ttest as the default.

The NB-t-test actually needs to be the default when CV is used, and losses over test sets cannot be considered as independent.
...

@bthirion
Copy link
Copy Markdown
Collaborator

bthirion commented Nov 7, 2025

Sorry again for the confusion regarding the default test. I explained the choice a few comments above.

Regarding the statistical test, the current issue is that the cross-validation scheme has not yet been implemented. Currently, the statistical test is performed using a single train/test split. In that case, when considering the loss values for each individual sample of the test set, they can be considered as independent and we could use ttest instead of nb-ttest as the default.
The NB-t-test actually needs to be the default when CV is used, and losses over test sets cannot be considered as independent.
...

OK, makes sense.

@bthirion
Copy link
Copy Markdown
Collaborator

bthirion commented Nov 7, 2025

I think it's OK for merging.

@jpaillard jpaillard merged commit acb8e20 into mind-inria:main Nov 8, 2025
24 checks passed
@jpaillard jpaillard deleted the PR_CFI branch November 8, 2025 12:00
@jpaillard jpaillard mentioned this pull request Dec 8, 2025
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.

Add a methods for calculating the p-values for CPI, PI and LOCO

3 participants