-
Notifications
You must be signed in to change notification settings - Fork 30
Add Strauss process for anti-clustering and refactor rng handling in random #160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Add rng machinery to distance tests - Add rng seed inside _ripley_test - Docstrings for seeds
- Pass rng around to downstream calls to poisson in strauss - Tests for strauss
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #160 +/- ##
=======================================
+ Coverage 74.5% 80.5% +6.0%
=======================================
Files 12 12
Lines 1904 1999 +95
=======================================
+ Hits 1419 1609 +190
+ Misses 485 390 -95
🚀 New features to boost your workflow:
|
martinfleis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't say much about the Strauss process but we should revisit the seed/rng logic to follow SPEC7.
pointpats/distance_statistics.py
Outdated
| metric="euclidean", | ||
| hull=None, | ||
| edge_correction=None, | ||
| seed=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not use seed anymore but rng see SPEC7 - https://scientific-python.org/specs/spec-0007/
pointpats/random.py
Outdated
| seed : int or None, default=None | ||
| Seed for initializing the random number generator if `rng` is not provided. | ||
| Has no effect if `rng` is explicitly passed. | ||
| rng : numpy.random.Generator or None, default=None | ||
| A NumPy random number generator. If None, a new generator is created | ||
| using `numpy.random.default_rng(seed)`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, this does not follow SPEC7, which is unfortunate for a new code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I will refactor to respect SPEC7.
Simply removing seed won't work here. Instead we need to refactor this a bit to get the correct behavior. I can do this for pointpats, but I'm wondering if we want to revisit moving random tooling up into libpysal to ensure consistency throughout the federation? |
where would that be consumed and what would it contain? |
where:
in terms of what it would contain in libpysal, something like: Then to use it in the downstream packages: Might be overkill to centralize this, but the key thing is to adopt a consistent pattern across the ecosystem for spec7. |
Overkill? Maybe. Ideal for centralization & consistency? Absolutely yes IMHO Getting everyone on board to use the centralized functionality? Good luck LOL |
|
It is a one-liner wrapper in another one-liner. I'd rather vote for transparency of using directly |
No description provided.