-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add solution for explicit randomization in subprocesses. #396
Add solution for explicit randomization in subprocesses. #396
Conversation
This isn't the recommended way to implement seeded random number generation. We should favour creating Here's how it's done in scikit-learn: https://github.com/scikit-learn/scikit-learn/blob/2a2772a87b6c772dc3b8292bcffb990ce27515a8/sklearn/utils/validation.py#L1207 We could use that as inspiration, even though it's using the legacy This doesn't really close #242. To solve that we should expose a |
454bea5
to
28288db
Compare
|
|
|
4a8559f
to
116f62a
Compare
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.
Thanks for the PR. I have left a couple of comments, but I think we need to discuss the general design for this. It is important to distinguish the different concepts used and how they enter the picture at which stages.
@mdbenito @AnesBenmerzoug Let's decide on one way. Do we want to go forward with a seed parameter approach or do we switch to a different approach. What are your thoughts? |
7bbd5e4
to
f216562
Compare
@kosmitive This error indicates that you must have made some mistake merging develop into your branch, because the function |
…ted test cases from test monte carlo.
src/pydvl/utils/types.py
Outdated
@@ -58,18 +83,10 @@ def maybe_add_argument(fun: Callable, new_arg: str) -> Callable: | |||
Returns: | |||
A new function accepting one more keyword argument. | |||
""" | |||
params = inspect.signature(fun).parameters | |||
if new_arg in params.keys(): | |||
if new_arg in unroll_partial_fn_args(fun): |
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.
What is the logic behind this change?
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.
Once a partial function is passed to maybe_add_argument
, the inner __call__
logic is neglected for these types and thus also if it is contained in the arguments. Furthermore partial
has to be used, because otherwise the wrapped function can't be pickled (happens for seed
but not for job_id
). So recursive partial
support is needed in the checking.
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.
More comments. Please double check all docstrings before requesting another review.
9fbeb70
to
a5931c7
Compare
a5931c7
to
6dee93d
Compare
98c5683
to
3a053d3
Compare
fa20d85
to
f3e3ff4
Compare
f3e3ff4
to
cb546ea
Compare
# Conflicts: # CHANGELOG.md
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.
@kosmitive I went ahead and pushed directly to your branch because I don't know how to explain better that you need to think of the readers when writing documentation. I also moved things around a bit and made a couple minor changes / simplifications.
Description
This PR closes #242, #392 and #398
Changes
pydvl.utils.numeric
,pydvl.value.shapley
andpydvl.value.semivalues
.Seed
and conversion functionensure_seed_sequence
.Postponed