fix(normalisation): retry on ValueError when sampling null ensemble - #52
Merged
Conversation
Merging this PR will degrade performance by 24.76%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | test_detrend_method[z_score-p10] |
1.4 ms | 1.8 ms | -24.76% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing fix/flaky-reciprocity-test (c29af52) with main (33476c0)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #52 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 29 29
Lines 842 866 +24
Branches 151 150 -1
=========================================
+ Hits 842 866 +24 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The$G(n,m)$ random graphs and feeds them to the metric function to build the null distribution. For small graphs, a random graph can coincidentally end up with a perfectly symmetric adjacency matrix (all edges reciprocated). The
@normalise_against_randomdecorator generates directedreciprocitymetric rejects such matrices withValueError, causing a flaky test failure.Fix: catch
ValueErrorfrom the metric function during the sampling loop and retry with a fresh random graph. Afor...elseguard raisesRuntimeErrorif valid samples cannot be collected withinn_rand_val x 10attempts, ensuring the null distribution always has exactly the requested number of samples.