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

How to visualize intermediate steps in Nestle #21

Open
cwsalgado opened this issue Feb 24, 2017 · 2 comments
Open

How to visualize intermediate steps in Nestle #21

cwsalgado opened this issue Feb 24, 2017 · 2 comments

Comments

@cwsalgado
Copy link

We would like to "make a movie" of how the iterations arrive to the solution.
We can run of course many times the program. But we actually we need to
access are res.sample and res.weights (or something similar) during run time.

@kbarbary
Copy link
Owner

I've done similar things for testing, via the callback keyword argument, which is a function that is evaluated on every iteration. This isn't fully documented, but the callback is currently passed a dictionary, containing keys:

  • 'it': running iteration number
  • 'logz': running evidence sum
  • 'active_u': active points in unit cube (2-d array)
  • 'sampler': The underlying Sampler object, through which you can access things like active bounding ellipsoids at each iteration (if you happen to know the internals of the sampler)

I have a notebook that uses the callback to animate active points and bounding ellipsoids at each iteration for the eggbox problem. I could try to clean that up and post it somewhere. But basically, it does something like this:

def my_callback(info):
    # do something with info['active_u'] and info['sampler'].ells, perhaps updating a matplotlib figure
    ...

result  = nestle.sample(..., callback=my_callback)

@kbarbary
Copy link
Owner

PS: great question. It would be nice to better document this sort of thing.

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

No branches or pull requests

2 participants