Skip to content

Conversation

lionelkusch
Copy link
Collaborator

I reformat the Gaussian estimation of knockoff in the format of classes, as conditional sampling.
I moved all the conditional samplers into statistical_tool.

Copy link

codecov bot commented Aug 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.38%. Comparing base (894ff9d) to head (53b36d9).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #366      +/-   ##
==========================================
- Coverage   99.43%   99.38%   -0.06%     
==========================================
  Files          22       20       -2     
  Lines        1247     1140     -107     
==========================================
- Hits         1240     1133     -107     
  Misses          7        7              

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

Thx for this refactoring. I have two relatively minor comments.

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.

Thanks, I agree that having both samplers implemented as classes makes sense.

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.

I think it limits extra work to integrate the test in this PR rather than having to fix something in an upcoming one. I made a suggestion for the tests.

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.

The PR is almost ready to merge

d = np.eye(n)
sigma = u * d * u.T
_s_equi(sigma)

Copy link
Collaborator

Choose a reason for hiding this comment

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

final assert ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did one test, tell me if it's ok.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, I mean that we should either drop lines 62-67 or add a finall assert.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I add a final assertion. I just want to check 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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@bthirion Can you check the assertion?

jpaillard
jpaillard previously approved these changes Sep 5, 2025
@lionelkusch lionelkusch added the API 2 Refactoring following the second version of API label Sep 9, 2025
@lionelkusch lionelkusch marked this pull request as draft September 24, 2025 13:44
@lionelkusch
Copy link
Collaborator Author

lionelkusch commented Sep 24, 2025

This PR need to be done after the PR PR 368

@lionelkusch lionelkusch marked this pull request as ready for review October 10, 2025 14:06
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add to the user guide a brief explanation of what goes in statistical_tools, to help developers navigate the folder organisation.

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.

done. I provide a very short explanation which should be completed in another PR.

self,
X: np.ndarray = None,
y: np.ndarray = None,
n_samples: int = 1,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Something is unclear here: IIUC, GaussianKnockoffs replaces gaussian_knockoff_generation and should therefore output $\tilde X$ of shape n_samples x n_features.
However, I have the impression that the n_samples specified here is meant to be the number of repeats in knockoffs generation similar to n_boostraps that calls multiple times repeat_gaussian_knockoff_generation

  • Also there should not be a y argument
  • And for the docstring of X, it should be the full input data no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just copied the signature of ConditonalSampler in order to have some equivalence and homogenisation of the API.
I know that the context is a bit different and the result will be different but I feel that it's better to keep it this link.

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.

3 participants