Skip to content

Releases: mggg/GerryChain

v0.3.2

29 Apr 21:51
6c9fb6b
Compare
Choose a tag to compare

This release patches a bug in one of our core functions, and adds some common optimization methods that we use to the main GerryChain library

What's Changed

  • Added SingleMetricOptimizer and Gingleator classes so that we can run short-burst, simulated annealing, and tilted runs
    • Added documentation with examples on how to work with these new classes. See our ReadTheDocs for more information
    • Special thanks to @jenni-niels for their work on this!
  • Fixed bug in the way that find_balance_edge_cuts_memoization and find_balance_edge_cuts_contration work. Now you must specify if you are intending to cut off a single epsilon-balanced district via a one-sided-cut or if you intend to split into two epsilon-balanced districts.
    • This primarily affected the gerrychain.tree.recursive_tree_part and gerrychain.tree.recursive_seed_part_inner functions.
    • There is now a bespoke epsilon_tree_bipartition function that deals with the case where we would like to split a subgraph into two epsilon-balanced districts.
  • Updated the way that the region-aware code works so that we also surcharge things that do not belong to any specified regions.
  • Updated the documentation for region-aware and improved the installation/reproducibility instructions.

Resolved Issues

  • Provided fix for #417. The method from_geodataframe will now attempt to allow you to continue without a crs set. You may also optionally provide an override for the given crs.

Full Changelog: v0.3.1...v0.3.2

v0.3.1 Release

02 Mar 00:10
Compare
Choose a tag to compare

This release is a small patch that improves the performance of our region-aware method and adds Python 3.12 support

What's Changed

  • All spanning trees are now drawn with a minimum spanning tree instead of a maximum spanning tree (if you run old code with the same random seed, this means that you are likely to get different results since the trees will be different)
  • Region-aware recom now looks for and deterministically selects for cut edges that bridge regions first before randomly selecting a cut edge.
  • Python 3.12 is now officially supported by GerryChain.

Breaking Changes

  • The API has changed the usage of weight_dict to region_surcharge across any instance where region-aware is called

Resolved Issues

  • #407 Now, bipartition_tree has different behaviour when region-aware recom is used. This method also allows for pair reselection whereas the biparition_tree_random does not have any modifications for region-aware or pair reselection.

Full Changelog: v0.3.0...v0.3.1

v0.3.0

02 Feb 17:23
ab56add
Compare
Choose a tag to compare

This release adds the capacity to run region-aware chains, makes some major updates to the documentation, and resolves quite a few of the long-standing issues on the repo.

What's Changed

  • Major updates have been made to all of the documentation to try to make it

    (i) More complete
    (ii) More accessible for new Python users

  • Bipartition Tree now has max_attempts default set to 100000 to prevent infinite loop conditions, but this value should also give plenty of time to sample sufficiently from the set of spanning trees.

  • The recom method now has functionality for running region-aware chains which allow for the construction of ensembles of districting plans that try not to split a particular region or set of regions

    • An updater tally_region_splits has been added to make quick tallying of the number of splits of a region type easy
  • Many of the issue tickets have been resolved. See below for more info.

Deprecations

  • Installation through conda-forge is no longer supported
  • Python 3.8 is no longer supported due to deprecated support in dependencies
  • We no longer support gerrychain.random for setting seeds. Instead, import the random module and set the random seed using random.seed(<seed-number>)

Resolved Issues

  • #412 Resolved due to deprecation of conda-forge

  • #409 Related to the following issue:

    • #325 SOME Partition objects are pickle-able, but not all. Any partition that uses an updater defined in terms of a lambda function or which contains an inner function that uses nonlocal data will not be pickle-able, and we want to maintain this functionality. For those wishing to store an entire chain state, please see the PCompress tool.
  • #408 Resolved with deprecation of the conda-forge

  • #364: The global random seed is no longer set in a custom random file. The user must now set the seed manually if they wish for their work to be reproducible.

  • #319 is now fixed for recom. In bipartition_tree the user may now specify the parameter allow_pair_reslection as true or false. The default is false to maintain backward compatibility, but in the case where this parameter is set to true, an error is propagated back up to recom and a new pair is selected there. The selection of the new pair does not advance the chain. See the documentation for more information.

  • #294 This is now a part of the "Good Data Practices" section of the documentation

  • #288 __repr__ methods have been added across the package

    • #235 The MarkovChain class now has an alias constraints for the is_valid property that allows for the printing and editing of constraints. For example. one may print the constraints with the call print(chain.constraints) which will print something like [<function single_flip_contiguous at 0x7f3d80f45b20>], and the constraints can be set with something like chain.constraints = [contiguous]. When set, the constraints are checked against the initial state of the chain. This improves the UX by making it so that you do not need to reinitialize a full MarkovChain object to experiment with different constraints.
  • #279 This has been partially addressed in the documentation update and the remaining reference materials for how to plot data are left to the documentation of matplotlib and seaborn

  • #44 This is now a part of the documentation.

Acknowledgements

Special thanks to @gabeschoenbach for his work on an earlier version of the Region Aware functionality for this release!

Full Changelog: v0.2.22...v0.3.0

v0.2.22

29 Apr 02:24
04ff4f9
Compare
Choose a tag to compare

Changes:

  • Adds support for Shapely 2.0 (#405)
  • Adds some type annotations to key functions (#377)
  • Fixes the use of node_repeats in _bipartitions_tree_random_all (#406)
  • Adds updaters for sample diversity statistics (#400)
  • Fixes a bug in uniform_spanning_tree (#401)

v0.2.20

18 Apr 21:43
18cde80
Compare
Choose a tag to compare

This release contains some bug fixes that were reported for the v0.2.19 release.

What's Changed

Full Changelog: v0.2.19...v0.2.20

v0.2.19

24 Feb 02:39
ae7e776
Compare
Choose a tag to compare

This release adds faster scoring/replaying of chains, as well as storing of CRS information in dual graphs. This is planned to be the last v0.2 release; the next release will be v0.3 and will contain massive speedups (15-16x) in chain run times.

If you use GerryChain, you may be interested in plan-evaluation-processing (docs), our production-tested plan evaluation tools that we use for our public reports and litigation work. In the future, this may be packaged as a submodule in GerryChain itself.

Cheers!

What's Changed

New Contributors

Full Changelog: 0.2.18...v0.2.19

New Seed Partition functions

04 Jun 15:14
0a7c547
Compare
Choose a tag to compare

Same as last release, but with the citation removed because it seems to have been causing issues with twine.

New Seed Partition functions

27 May 20:47
34ceda8
Compare
Choose a tag to compare

This release contains need seed partitioning functionality, courtesy of Talia Blum.

Bug fixes

24 Feb 21:48
01b8801
Compare
Choose a tag to compare

Two major changes in this release:

  1. When we generate a random spanning tree we were assigning a "weights" key to the edges of the graph. Apparently Networkx uses this field for its other functions (like when generating the laplacian). This was fixed by changing the keyword to "random_weight" instead.
  2. The default edge finding algorithm is the memoized algorithm now, which should perform better in terms of speed.

Testing Upgrade

11 Feb 19:04
36bda96
Compare
Choose a tag to compare
0.2.14

add space to README (#349)