{"action":"created","issue":{"url":"https://api.github.com/repos/ligo-cbc/pycbc/issues/1149","repository_url":"https://api.github.com/repos/ligo-cbc/pycbc","labels_url":"https://api.github.com/repos/ligo-cbc/pycbc/issues/1149/labels{/name}","comments_url":"https://api.github.com/repos/ligo-cbc/pycbc/issues/1149/comments","events_url":"https://api.github.com/repos/ligo-cbc/pycbc/issues/1149/events","html_url":"https://github.com/ligo-cbc/pycbc/pull/1149","id":182906427,"number":1149,"title":"Add cyclic and reflected boundaries","user":{"login":"cdcapano","id":8258446,"avatar_url":"https://avatars.githubusercontent.com/u/8258446?v=3","gravatar_id":"","url":"https://api.github.com/users/cdcapano","html_url":"https://github.com/cdcapano","followers_url":"https://api.github.com/users/cdcapano/followers","following_url":"https://api.github.com/users/cdcapano/following{/other_user}","gists_url":"https://api.github.com/users/cdcapano/gists{/gist_id}","starred_url":"https://api.github.com/users/cdcapano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdcapano/subscriptions","organizations_url":"https://api.github.com/users/cdcapano/orgs","repos_url":"https://api.github.com/users/cdcapano/repos","events_url":"https://api.github.com/users/cdcapano/events{/privacy}","received_events_url":"https://api.github.com/users/cdcapano/received_events","type":"User","site_admin":false},"labels":[{"id":286162123,"url":"https://api.github.com/repos/ligo-cbc/pycbc/labels/work%20in%20progress","name":"work in progress","color":"bfe5bf","default":false}],"state":"open","locked":false,"assignee":{"login":"cmbiwer","id":10871764,"avatar_url":"https://avatars.githubusercontent.com/u/10871764?v=3","gravatar_id":"","url":"https://api.github.com/users/cmbiwer","html_url":"https://github.com/cmbiwer","followers_url":"https://api.github.com/users/cmbiwer/followers","following_url":"https://api.github.com/users/cmbiwer/following{/other_user}","gists_url":"https://api.github.com/users/cmbiwer/gists{/gist_id}","starred_url":"https://api.github.com/users/cmbiwer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmbiwer/subscriptions","organizations_url":"https://api.github.com/users/cmbiwer/orgs","repos_url":"https://api.github.com/users/cmbiwer/repos","events_url":"https://api.github.com/users/cmbiwer/events{/privacy}","received_events_url":"https://api.github.com/users/cmbiwer/received_events","type":"User","site_admin":false},"assignees":[{"login":"cmbiwer","id":10871764,"avatar_url":"https://avatars.githubusercontent.com/u/10871764?v=3","gravatar_id":"","url":"https://api.github.com/users/cmbiwer","html_url":"https://github.com/cmbiwer","followers_url":"https://api.github.com/users/cmbiwer/followers","following_url":"https://api.github.com/users/cmbiwer/following{/other_user}","gists_url":"https://api.github.com/users/cmbiwer/gists{/gist_id}","starred_url":"https://api.github.com/users/cmbiwer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmbiwer/subscriptions","organizations_url":"https://api.github.com/users/cmbiwer/orgs","repos_url":"https://api.github.com/users/cmbiwer/repos","events_url":"https://api.github.com/users/cmbiwer/events{/privacy}","received_events_url":"https://api.github.com/users/cmbiwer/received_events","type":"User","site_admin":false}],"milestone":null,"comments":1,"created_at":"2016-10-13T21:31:56Z","updated_at":"2016-11-11T16:37:52Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ligo-cbc/pycbc/pulls/1149","html_url":"https://github.com/ligo-cbc/pycbc/pull/1149","diff_url":"https://github.com/ligo-cbc/pycbc/pull/1149.diff","patch_url":"https://github.com/ligo-cbc/pycbc/pull/1149.patch"},"body":"Kombine can have trouble with hard boundaries in large dimensional problems, especially in areas of the parameter space that are close to where multiple boundaries intersect (a hyperdimensional \"corner\"). The reason for this is kombine uses a KDE for its proposal density; since this smoothly varies to 0, the KDE can \"leak\" across boundaries. Depending on the shape of the parameter space and the priors, this may cause nearly all jump proposals to be outside of the space permitted by the prior. When that happens, all points are rejected, and a walker barely moves from its initial conditions. For example, note the outlier points close to the upper bound on the right ascension (alpha) in this run on GW150914:\n\nhttps://www.atlas.aei.uni-hannover.de/~cdcapano/LSC/projects/pycbc_inference/cbc/gw150914/kombine/larger_dist-5Kwalkers_1Kiterations-500kde_pts/posteriors-scatter.png\n\nI think (but not certain; have to test) that this may also be why Miriam's multi-mode ringdown runs using kombine return junk. None of the points are evolving, apparently because all of the jump proposals end up outside of the prior boundaries.\n\nThis patch tries to remedy this by introducing the ability to use cyclic and reflected boundaries, rather just the \"hard\" boundaries currently used. By cyclic, I mean that if a value exceeds the bounds, it will be wrapped back around. For example, if you have a uniform distribution between 0 and 2pi, and the jump proposal is for 3pi, then this will be mapped back to pi. By reflected, I mean that if value exceeds the bounds it will be reflected back by the amount it exceeds. So, if you have inclination between 0 and pi, and the jump proposal is 5pi/4, the value will be mapped to 3pi/4. I hope this might also be useful for parameters that have an unphysical boundary close to the peak of the log likelihood; say, if we sample in eta on a signal that is close to equal mass, putting a reflected boundary at eta = 0.25 might help.\n\nAs a first step, I've added a `boundaries_utils.py` module to inference that allows you to set different types of boundaries. Here are some plots of what cyclic and reflected boundaries at [-1,1) do to a set of input values between [-10, 10):\nhttps://www.atlas.aei.uni-hannover.de/~cdcapano/public_scratch/boundary_plots/cyclic_bounds.pdf\nhttps://www.atlas.aei.uni-hannover.de/~cdcapano/public_scratch/boundary_plots/reflect_left.pdf\nhttps://www.atlas.aei.uni-hannover.de/~cdcapano/public_scratch/boundary_plots/reflect_right.pdf\nhttps://www.atlas.aei.uni-hannover.de/~cdcapano/public_scratch/boundary_plots/reflected_well.pdf\n\nI don't intend this patch to be merged yet; I just wanted to get the PR started. I'm currently adding the ability to distributions.py and to likelihood.py to make use of the `Bounds` class introduced here, which I'll update this PR with.\n"},"comment":{"url":"https://api.github.com/repos/ligo-cbc/pycbc/issues/comments/259997934","html_url":"https://github.com/ligo-cbc/pycbc/pull/1149#issuecomment-259997934","issue_url":"https://api.github.com/repos/ligo-cbc/pycbc/issues/1149","id":259997934,"user":{"login":"cdcapano","id":8258446,"avatar_url":"https://avatars.githubusercontent.com/u/8258446?v=3","gravatar_id":"","url":"https://api.github.com/users/cdcapano","html_url":"https://github.com/cdcapano","followers_url":"https://api.github.com/users/cdcapano/followers","following_url":"https://api.github.com/users/cdcapano/following{/other_user}","gists_url":"https://api.github.com/users/cdcapano/gists{/gist_id}","starred_url":"https://api.github.com/users/cdcapano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdcapano/subscriptions","organizations_url":"https://api.github.com/users/cdcapano/orgs","repos_url":"https://api.github.com/users/cdcapano/repos","events_url":"https://api.github.com/users/cdcapano/events{/privacy}","received_events_url":"https://api.github.com/users/cdcapano/received_events","type":"User","site_admin":false},"created_at":"2016-11-11T16:37:52Z","updated_at":"2016-11-11T16:37:52Z","body":"Ok, this patch is just about ready to merge. I'm adding a hold label while I do a PE run to check that it works.\r\n\r\n@stevereyes01 I addressed the issue you had with the Gaussian.rvs function not returning a structred array in this patch. In the process, I found that there was a bug in the Gaussian distribution; the pdf wasn't normalized correctly if bounds were provided. This patch fixes that.\r\n\r\nInitializing a Gaussian is also a bit different. Instead of providing a tuple that includes the mean and the variance for each parameter, you just provide the bounds (if any). If you want to specify a mean and variance for the parameter, you add additional keyword arguments ending in `_mean` and `_var`. For example, the original way: `dist = Gaussian(mass1=(1,3,1.4,0.1))` is now `dist = Gaussian(mass1=(1,3), mass1_mean=1.4, mass1_var=0.1)`. If you don't provide a mean or var arg, it will default to zero mean with unit variance. Likewise, you can provide `None` for the bounds, in which case it will be an unbounded Gaussian.\r\n\r\nAside from that, this patch doesn't change the API for any of the other distributions. The difference is you can now specify what sort of bounds to use by adding `btype-(min|max)-{param} = reflected|circular|open|closed` to the ini file for pycbc inference. `UniformAngle` defaults to using circular bounds on `[0,2pi)` while `SinAngle` defaults to using reflected bounds on `[0,pi]`. By extension, `UniformSolidAngle` (`UniformSky`) default to being circular on `[0,2pi)` in the azimuthal angle (`ra`) and `[0,pi]` on the polar angle (`[-pi/2,pi/2]` in `dec`).\r\n\r\nWhen the sampler passes parameter values to the likelihood evaluator, they are mapped to new values according to the boundary conditions before being passed to the waveform generator and prior functions. So, e.g., while the sampler will see `ra=2.1*pi`, the waveform generator and prior will see `ra=0.1*pi`. The mapped values are saved to the output file. "}}
{"actor":{"display_login":"cdcapano"}}