Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflicting population balance constraints #353

Closed
AtlasCommaJ opened this issue Mar 14, 2021 · 2 comments
Closed

Conflicting population balance constraints #353

AtlasCommaJ opened this issue Mar 14, 2021 · 2 comments

Comments

@AtlasCommaJ
Copy link

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
Copy link
Author

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

@peterrrock2
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants