-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Make marginal_counts act on Result memory #7711
Conversation
Pull Request Test Coverage Report for Build 2015216391
💛 - Coveralls |
377cf3c
to
c53dd44
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 pushing this up and sorry for the delay in an initial review. I think this is a good start, but I have a few inline comments that I think we should address. The biggest things are:
-
While this works correctly for the use case you wrote a test for, calling
marginal_counts(result)
on aresult
with memory will fail with aTypeError
. -
I also think we should put the marginalization of memory behind a feature flag (or maybe a separate function) because it is a change in behavior on a potentially inplace modification on a results object which might be unexpected for users. So we should make this opt-in somehow to not surprise people
releasenotes/notes/marginal_counts_act_on_memory-0a9b58d0b95046dd.yaml
Outdated
Show resolved
Hide resolved
@mtreinish I will pick up the inline comments. Initially my idea was that non marginalizing the
I would prefer to make |
…t-terra into fix/margin_counts_memory
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 quick update, the code LGTM now. I think you've covered all the issues in the previous version and the behavior is much more stable and clearly defined now. The only thing missing now is an upgrade
section release note documenting the change in behavior around the memory
field in the result when calling marginal_counts()
. We need to document that the default behavior of maginal_counts()
is changing from previous releases, why that change was made, and how users can restore the previous behavior (just by setting marginalize_memory=None
) if that's what they need. Once that's in the release note file I think this is good to go.
releasenotes/notes/marginal_counts_act_on_memory-0a9b58d0b95046dd.yaml
Outdated
Show resolved
Hide resolved
releasenotes/notes/marginal_counts_act_on_memory-0a9b58d0b95046dd.yaml
Outdated
Show resolved
Hide resolved
…6dd.yaml Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
…6dd.yaml Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
…t-terra into fix/margin_counts_memory
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, thank you for the prompt updates.
Summary
The
marginal_counts
method only acted on theExperimentResult.data.counts
, not theExperimentResult.data.memory
field. This PR updates the method so that thememory
is also marginalized. Fixes #7448Details and comments