Skip to content

Periodic parameters improvement by rotating them #460

Open
@segasai

Description

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]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions