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

Periodic parameters improvement by rotating them #460

Open
segasai opened this issue Nov 17, 2023 · 0 comments
Open

Periodic parameters improvement by rotating them #460

segasai opened this issue Nov 17, 2023 · 0 comments
Labels
enhancement upgrades and improvements help wanted help! question questions about stuff

Comments

@segasai
Copy link
Collaborator

segasai commented Nov 17, 2023

I am thinking about potential improvement of how dynesty deals with periodic parameters.
Currently the periodicity is ignored when ellipsoid bounds are constructed, which will lead to modes being split for example if they wrap around. (i.e. 2 period parameters with the center at zero will make 4 modes)

I'm thinking about transforming the points before making the ellipsoidal bounds. I.e. i x is periodic parameter, its' better to work with it in space of (x-x0)mod 1 where x0 is chosen such as to put points in the center of the cube.

I don't yet know if the change can be made in localised way to not make the code too complex and slow down the non-periodic cases. IMO the implementation of the feature should not bee too complex, otherwise it's not worth it.

Feedback/patches/ideas welcome.

PS the best rotation of the for 1d set of points is the rotation that puts the biggest gap between points at zero.
Something like this:

x=(1+np.random.normal(size=10)*.1)%1
print(x)
xind = np.argsort(x)
x_sort = np.concatenate(([x[xind[-1]]-1],x[xind]))
bestpos = np.argmax(np.diff(x_sort))
cen = (x_sort[bestpos] + x_sort[bestpos + 1]) / 2.
x_transform = (x + 2 - cen)%1
print (x_transform)
>>> [0.07819544 0.07965051 0.13322925 0.92580754 0.10810778 0.90248174 0.9690383  0.01715838 0.10589642 0.11196911]
>>> [0.56033994 0.56179501 0.61537375 0.40795205 0.59025229 0.38462625
 0.45118281 0.49930289 0.58804092 0.59411362]
@segasai segasai added enhancement upgrades and improvements help wanted help! question questions about stuff labels Nov 17, 2023
@segasai segasai changed the title Period parameters improvement by rotating them Periodic parameters improvement by rotating them Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement upgrades and improvements help wanted help! question questions about stuff
Projects
None yet
Development

No branches or pull requests

1 participant