Skip to content

Conversation

@lionelkusch
Copy link
Collaborator

No description provided.

@lionelkusch lionelkusch added the test Question link to tests label Sep 9, 2025
@lionelkusch lionelkusch linked an issue Sep 9, 2025 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Sep 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.08%. Comparing base (15c7691) to head (ed23db6).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #387   +/-   ##
=======================================
  Coverage   98.08%   98.08%           
=======================================
  Files          22       22           
  Lines        1147     1147           
=======================================
  Hits         1125     1125           
  Misses         22       22           

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

)

signal_noise_ratio_hat = np.linalg.norm(y - noise) / np.linalg.norm(noise)
if signal_noise_ratio != np.inf:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ne we don't want to have np.inf all over the place. We need to regularize the noise norm.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What do you mean by regularize the noise norm?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Set it to a non- zero numerical value in any 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.

I don't understand what you mean by non-zero numerical value.
The inf is the case where there is no noise in the signal which seems for me a good value.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if signal_noise_ratio != np.inf:
signal_noise_ratio_hat = np.linalg.norm(y - noise) / max(np.linalg.norm(noise), 1e-6)

I think something like that should solve the division by 0. It will however, not work for the assert_almost_equal test

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 need to have a way to create data without noise.
What is the best way of doing it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

IMO, the problem comes from returning noise from the simulation. It is redundant with the other outputs (can be obtained by $y-X\beta$), and I don't see a case where it is useful in practice (there's no example using it, for instance).

We could then use the convention SNR=None for a noiseless scenario.

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 the default value should not be None in that case. It could be 0.

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 prefer a default value of 1.

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK

@jpaillard
Copy link
Collaborator

@lionelkusch, can we, for the moment, remove the np.inf case and merge to solve the bug, which is problematic in many other open PRs.
We could then open a separate issue & PR to discuss how to deal with SNR in simulations.

@lionelkusch
Copy link
Collaborator Author

@jpaillard I don't see the impact on the other PR. The test was passing before with only a warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test Question link to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Division by 0 in test_multivariate_simulation_2D

3 participants