Skip to content
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 MALA allow repeated ask() #994

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

MichaelClerx
Copy link
Member

@MichaelClerx MichaelClerx commented Oct 8, 2019

See #996

There's no reason not!

Also cleaned up the tests a bit

@codecov
Copy link

codecov bot commented Oct 8, 2019

Codecov Report

Merging #994 (c211e33) into master (a6a1a39) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##            master      #994     +/-   ##
===========================================
  Coverage   100.00%   100.00%             
===========================================
  Files           84        63     -21     
  Lines         8823      6277   -2546     
===========================================
- Hits          8823      6277   -2546     
Impacted Files Coverage Δ
pints/_mcmc/_mala.py 100.00% <100.00%> (ø)
pints/io.py 100.00% <0.00%> (ø)
pints/_core.py 100.00% <0.00%> (ø)
pints/_util.py 100.00% <0.00%> (ø)
pints/noise.py 100.00% <0.00%> (ø)
pints/_logger.py 100.00% <0.00%> (ø)
pints/_log_pdfs.py 100.00% <0.00%> (ø)
pints/toy/_cone.py 100.00% <0.00%> (ø)
pints/_boundaries.py 100.00% <0.00%> (ø)
pints/_evaluation.py 100.00% <0.00%> (ø)
... and 77 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a6a1a39...17feb6e. Read the comment docs.

Copy link
Collaborator

@ben18785 ben18785 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the clean up of the tests, thanks. Not sure I follow the reasons for removing the checks for repeated asks (seeing as I don't see when someone would want to do this)?

Comment on lines 169 to 168
if self._ready_for_tell:
raise RuntimeError('Ask() called when expecting call to tell().')

# Propose new point
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I follow why we'd want to remove this check? Probably missing the point, but what would be a use case for repeatedly calling ask?

Comment on lines -199 to 195
if not self._ready_for_tell:
if self._proposed is None:
raise RuntimeError('Tell called before proposal was set.')
self._ready_for_tell = False

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, probably not getting something but don't quite get why we'd remove these checks.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's more in line with what we have in the other MCMC methods, with the exception of the ones that do more complicated stuff in ask() than just set a proposal.

So no very strong reason! Just that it's possible to let users ask() as often as they like in this case (and always get the same result), and it lets us remove a variable...

We might want to disallow this everywhere instead though? In which case we'd have to update the documentation for SingleChainMCMC and MultiChainMCMC a bit to make this explicit...

@ben18785
Copy link
Collaborator

ben18785 commented Oct 8, 2019 via email

@MichaelClerx
Copy link
Member Author

Made a ticket here #996

@MichaelClerx
Copy link
Member Author

Can we re-open discussion on this, @ben18785 and @martinjrobins ? See especially #996

@MichaelClerx
Copy link
Member Author

No thoughts on this?
It needs to be resolve one of two ways, I think:

  1. Make it so that you can only ask once, in every method: a second call to ask() breaks everything
  2. Make it so that you can ask as often as you like, in every method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants