GerryChain icon indicating copy to clipboard operation
GerryChain copied to clipboard

Conflicting population balance constraints

Open AtlasCommaJ opened this issue 3 years ago • 1 comments

The population balance percentage can be set in two places.

in the recom proposal: def recom(partition, pop_col, pop_target, epsilon, node_repeats=1, method=bipartition_tree):

and as a constraint: def within_percent_of_ideal_population(initial_partition, percent=0.01, pop_key="population"):

This allows you to set a coarse value for the constraint, perhaps to let an initial partition pass through, but then enforce a stricter value later, which can cause the chain to stall. You can replicate this behavior in an extreme case: set the first to 0.0001 and the population to 0.99, then try to run a chain. It should start without warnings, but never finish an iteration.

AtlasCommaJ avatar Mar 14 '21 18:03 AtlasCommaJ

Avenues of fixing the issue: -ensure the initial partition is within the deviation specified by the recom proposal, as the constraint does -throw a warning if these two values are different

AtlasCommaJ avatar Mar 14 '21 18:03 AtlasCommaJ

Hey! Thank you for bringing this to our attention! This is an intended behavior for our package. The reason for having two different places to set the population constraints -- in the drawing of the tree and the acceptance function -- is that placing a constraint in each of these locations does slightly different things to the distribution that you are targeting, and it is up to the user to determine which constraint is appropriate for their problem set (or if both are appropriate!). However, in practice, the stricter population bound should always be obeyed for any accepted proposed partition. We have also recently added some functionality to help with the sticking problem. For more information, please see https://gerrychain.readthedocs.io/en/latest/user/recom/#what-to-do-if-the-chain-gets-stuck

peterrrock2 avatar Apr 28 '24 23:04 peterrrock2