Repository navigation
Organize by ensemble strategy - #320
Conversation
Still needs completed tests
In particular, there's a problem that the make_choosers was only working if there was actually a mover of each type for each ensemble. Of course, this isn't the case: for the minus ensemble, there's only one legal type of move! Still need to do some serious cleanup to get this working.
Should be ready to add the new choosers and root next -- looks like the default weight numbers are reasonable.
Runs, but still needs extensive testing.
|
Finally! I'm calling this one ready for review and merge. I've only been working on this since, oh, June. |
There was a problem hiding this comment.
What would you call this then? The underlying idea was that since we accept samples we check, if all samples can be accepted and otherwise we multiply the bias which I think is something like the forward proposal probability.
There was a problem hiding this comment.
This should not be a method. That's my point. It breaks the ability to maintain detailed balance for arbitrary moves. The overall acceptance is not of a sample. It is of an entire active sample set. In most moves, most of the sample set doesn't change, so this doesn't matter. However, the current structure of path movers will not work in the general case. See #251, #294.
|
Hmm, my post disappeared... Anyway just a quick question to confirm. Anyway, I think this is ready to be merged, yes? |
Precisely. Single replica TIS needs to be based on a "choose-the-ensemble-first" strategy (because the ensemble is given, so there's no "choice" to be had). This lets us switch between the two approaches. The important thing is that we maintain the same probabilities for each mover. The original approach was "choose a move type, then choose a mover." From this we can get an absolute probability of choosing each individual mover. The ensemble-first strategy is "choose an ensemble, then choose a mover." Again, we can get the absolute probability of each individual mover. The smart part of this PR is that when we change from one organization strategy to the other, those absolute probabilities remain the same.
As soon as the newest commit passes tests, yes, it should be. |
|
Great, this is really cool. Looking forward to seeing this in the move tree ... Merging... |
What this PR does: Makes it possible to rearrange the “global” structure of the move decision process. Standard behavior is to select a move type, then a specific move within that. Now we can select an ensemble first, then a move within that. We can also switch between these.
Why we should have this: Ensemble-first organization is a step toward SRTIS. The ability to conserve move probabilities when switching selection order makes comparison between SRTIS and normal RETIS more straightforward, and makes it easy for users to switch from one approach to the other.
What is hard about this: My intuition expects different behaviors between ensemble-first and move group-first organization. Details below, but figuring our that there was a difference, and then figuring our exactly what the difference was took some effort (and a major rewrite after my first draft of this).
Tasks:
Background
Before getting into the details of what this PR contains, let me refresh a few essential background points. A few of these came from #289. The big thing is that movers can be uniquely defined by
(groupname, ensemble_signature), and that the main thing that comes out of the highest-level organization strategy is thechoice_probabilities, which is a dictionary of{PathMover : probability}.Goals
scheme.choice_probabilitiesshould be preserved (unless explicitly overridden)Intuitive behavior differs by global organization type
This is one of the weirder parts of this PR, but it basically boils down to this: when I set the move-type weights in a move-type-first organization scheme, I think of a dictionary like this:
The tricky bit is that there may be 5 shooting movers for every minus mover. If the weights represented “probability of choosing this move type”, then we’d do 5 shooting moves for every minus move. But since there are 5 different shooting movers, that would mean each individual shooting mover was used as frequently as the minus mover.
That’s not what I want. I want the minus move to be done less frequently than shooting: about 1/5 as often. So rather than make the user do the math to get that to work (as my old code did), I make it so that the code figures it out automatically. This means that (assuming all ensembles have the same weight) each shooting move will be 5 times as likely to occur as a minus move. That’s what we want.
On the other hand, ensemble-first organization does just what you’d expect: first you pick an ensemble with the random probability given by
ensemble_weights, then you pick a move which has that ensemble as one of its initial ensembles.Ensemble-first organization does not have a unique solution
The quantity that is conserved is the total choice probability for each ensemble. However, some ensembles (e.g., replica exchange) have more than one input ensemble. This means that they show up in more than one place in the ensemble-first decision process. There is not a unique way to split these weights, so the approach I’ve used is to say that each ensemble contributes the same to the total probability of choosing that mover. Details on this problem, and the approach I used to solve it, are in this gist.
Reasonable defaults
On one hand, it would make sense to normalize most of these results: so the probabilities should be normalized probabilities. On the other hand, that’s harder as a way to think about it -- and obviously doesn’t work with the
group_weightsdescribed above.So the approach I’ve taken is the following:
choice_probabilityreally is a normalized probabilitygroup_weightsis rescaled such that’shooting’is 1.0 (we usually think in terms of shooting movers); if there is no group called’shooting’, then we rescale so that the most common value in thegroup_weightsdictionary is 1.0.mover_weightsare rescaled so that the most common number within each second-level decision is 1.0.These are so that, if you say “I want this twice as much shooting in
ensembleAasensembleB,” you can just change the default 1.0 to 2.0.Caveats when overriding
There are two levels of weights to override -- the weight that is sorted by (either move group or input ensemble) and the weight within that sorting group.
For the sorting groups, overriding the weights are easy: the input dictionaries take the group name or the ensemble and map it to a weight (
group_weightorensemble_weight).For the second level, this is a little more complicated. First, note that these weights should only be used by pretty advanced users -- typical needs are met without them. These weights are referred to as
mover_weights, and the shape of the dictionary keys is different between the two types of organization strategy. ForOrganizeByMoveGroupStrategy, the keys are(groupname, ensemble_signature); forOrganizeByEnsembleStrategy, they are(groupname, ensemble_signature, ensemble).In both cases, the
mover_weightsdefault to 1.0, as doesensemble_weights. However,group_weightsdefaults to the version shown above. This means that to get the standard default behavior with ensemble-first organization, your scheme needs anOrganizeByMoveGroupStrategy, followed by anOrganizeByEnsembleStrategy. (This will eventually be hidden to SRTIS users, who will just ask for an SRTISScheme that handles all of that automatically.)