Increase sampling diversity by RedBlue one-to-one mapping#540
Increase sampling diversity by RedBlue one-to-one mapping#540JohannesBuchner wants to merge 2 commits intodfm:mainfrom
Conversation
Currently, the stretch move resamples again. Instead of finding a one-to-one mapping of red and blue, this can reuse points, decreasing proposal diversity. This commit favors a one-to-one mapping.
this avoids complex append/concatenate code on multi-dimensional arrays
dfm
left a comment
There was a problem hiding this comment.
Thanks! Looks good but here are some high level comments:
-
I'd prefer not to change default behavior. If we add this behavior, let's put it under an option that gets passed to the move. This project is pretty much in maintenance mode and I don't think it's a great idea to dramatically change default behavior like this.
-
This won't necessarily play nicely with the
nsplitsandrandomize_splitparameters to theRedBlueMove. Ifnsplits != 2then theelsewill always be hit, and ifrandomize_split is Falsethen this will deterministically reuse the same helper walker every time. Perhaps a better approach would be to shufflearange(Nc)and then appendrandint(Nc, size=(Ns-Nc,))ifNc < Ns?
| @@ -30,4 +30,18 @@ def get_proposal(self, s, c, random): | |||
| zz = ((self.a - 1.0) * random.rand(Ns) + 1) ** 2.0 / self.a | |||
| factors = (ndim - 1.0) * np.log(zz) | |||
| rint = random.randint(Nc, size=(Ns,)) | |||
There was a problem hiding this comment.
Perhaps remove this line? It's no longer needed.
Currently, the stretch move resamples again. Instead of finding a one-to-one mapping of red and blue, this can reuse points, decreasing proposal diversity.
This commit favors a one-to-one mapping.