-
Notifications
You must be signed in to change notification settings - Fork 78
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
Not possible to merge runs with different number of batches #481
Comments
Thanks for the report! I will take a look. |
Hello Sergey, I don't know if this worked before as I started to use this feature just recently, out of need. I checked that this was at least in the dynesty version 1.
I hope this helps. Cheers Rodrigo Leiva |
Now I create a unique batch list. I.e. if one run used [-inf, inf], [-5,5], [-4,4] and another [-inf, inf], [-5,5], [-3,2] the runs will be [-inf,inf] [-5,5] [-4, 4] [3,2] I also add a test that test for issue uncovered in #481
I have tentatively developed a fix ( #482 ) to this. Since it involves also some refactoring of the way merge is done, I'll think a bit more about it before committing (i.e. if it needs more tests). |
I have merged #482, so the issue should be now fixed in master branch. |
Dynesty version
2.1.4 installed with pip
Describe the bug
It is not possible to merge two runs with different number of batches (eg. run 1 with 4 batches, and run 2 with 2 batches).
As a consequence, it is also not possible to merge three or more runs, each with the same number of batches if the bounds are all different.
Setup
Here a simple code that reads three pickle files and attempt to merge them. Each pickle file has two batches, a baseline batch plus an additional batch in mode=auto. The latest means that the bounds for the baseline runs are -inf, inf, while for the additional batch will be different in each run.
** Dynesty output **
Bug
In the previous example, merging run 1 with 2 works fine, but when merging the (1+2) with 3 generates this error in utils.py line 1980.
For example, when attempting to merge two runs, imported from a checkpoint pickle file.
line 1980, in _merge_two
if np.all(base_info['bounds'] == new_info['bounds']):
ValueError: operands could not be broadcast together with shapes (4,2) (2,2)
Additional context
My quick and dirty workaround was to replace utils.py line 1980 with these
but I think that _merge_two() could need more careful reworking. For example, it could merge all the baselines into a single batch if the bounds are the same, and then add the additional batches. I'm not sure about this anyway.
Notice that if I attempt to merge N runs, all with a baseline batch, all have bounds -inf, inf the merging works fine.
Other combinations of runs with M batches each should work fine as well as long as the batches bounds match. Each execution of _merge_two() will generate a M batches instead of 2xM as in the general case. I didn't test it.
The text was updated successfully, but these errors were encountered: