-
-
Notifications
You must be signed in to change notification settings - Fork 3
Refactor for clarity, add comments. #57
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
dc0581c to
059b0f4
Compare
|
For the tests - I wasn't sure what to do. I think the original tests are assuming that something like the following will always give the same output value # In the test function.
np.random.seed(2025)
# In `select_proposals`
np.random.seed(None)
i = np.random.choice(1000) # e.g.but in my hands, that is not true. Accordingly the tests on |
We were confused by the algorithm, and this seemed generally undesirable, so we have attempted a refactor for greater clarity. We've also used the more standard RNG instance pattern for the random number generation. The tests are failing, but this seems also to be true of `main`.
059b0f4 to
e43b361
Compare
lucascolley
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.
LGTM, thanks Matthew!
|
@lucascolley - what say you for the tests? |
|
#57 (comment) sounds good to me. What is the diff to make the tests pass? https://github.com/15r10nk/inline-snapshot could make that easier to find. |
This makes it easier to compare expected to actual test output.
|
OK - I've added some tests to assert the proportions match the weights, and updated the test output to the current test output. I did a little more refactoring of the project random selection for clarity. I've also added a |
Although doing it in one go is neater, perhaps it will delay review by forcing reviewers to confirm it gives the same output.
|
I've reverted the algorithm to the stepwise selection procedure; ordering and then confirming is neater to my eye, but I thought it would require extra review work to confirm it gives equivalent results. I did use |
60d52f6 to
848c0a6
Compare
We were finding it hard to follow the algorithm, and this seemed generally undesirable, so we have attempted a refactor for greater clarity.
We've also used the more standard RNG instance pattern for the random number generation.
The tests are failing, but this seems also to be true of
main.