-
Notifications
You must be signed in to change notification settings - Fork 11
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
gp does not own its data #70
Comments
I expect this has more to do with how you're setting up the model when you restart - rather than anything to do with loading the chain. How are you saving the GP and log probability function between runs. Are you pickling it? See if you can put together a very simple example that reproduces this issue and we'll see what we can do. |
You find the example below. It's basically a copy/paste of the example in https://celerite2.readthedocs.io/en/latest/tutorials/first/, with the difference that the gp.compute() is inside the log_prob function, because in general i need to optimize a jitter term to add to yerr (I haven't implemented it in the example). I have also put the sampler in a pool. The example raises the same exception as my code at the very first run of the sampling. It doesn't even need to load a previous h5 file. I don't understand why, yet it would be good to know what I'm doing wrong in the example.
|
I can look more closely later, but what if you use the globally defined |
I can confirm that my suggestion seems to fix things. This must be something to do with how the arrays are getting passed around by multiprocessing. We can leave this issue open for that, but it might be nice to set up a simpler example that doesn't depend on emcee directly. The issue is multiprocessing! |
can you show me your working example? i'm trying to use the gp as a global
variable with no success (likely because i'm such a bad coder)
…On Fri, Sep 23, 2022 at 5:02 PM Dan Foreman-Mackey ***@***.***> wrote:
I can confirm that my suggestion seems to fix things. This must be
something to do with how the arrays are getting passed around by
multiprocessing. We can leave this issue open for that, but it might be
nice to set up a simpler example that doesn't depend on emcee directly. The
issue is multiprocessing!
—
Reply to this email directly, view it on GitHub
<#70 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACQ5BY2HB3GKVGUKXTLFOWDV7XA7XANCNFSM6AAAAAAQT3YL7A>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Sure thing! Here's how I edited your code: https://gist.github.com/dfm/b2b6cdfc61c4de8b5594e636e3c5c70f |
I implemented your solution in my code and it fixed the issue. Also, it is ~10% faster! Thanks twice! As for this issue, you can close it if you prefer, and I give you the copyright to simplify and publish my example blaming it on multiprocessing. Unfortunately I wouldn't know how to simplify it. Thanks again |
Hi,
I am using emcee to maximize a likelihood function to which I pass a celerite2.GaussianProcess object. I store the chain in a h5 file. When I start the emcee sampling from scratch there is no issue, but if I restart the sampling loading the h5 file then the gp.compute() instruction throws this error:
File ".../python3.6/site-packages/celerite2/core.py", line 313, in compute self._t, self._diag, c=self._c, a=self._a, U=self._U, V=self._V File ".../python3.6/site-packages/celerite2/terms.py", line 157, in get_celerite_matrices c.resize(J, refcheck=False) ValueError: cannot resize this array: it does not own its data
How can I fix it? Thanks
The text was updated successfully, but these errors were encountered: