Releases: mggg/GerryChain
v0.3.2
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
andGingleator
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
andfind_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
andgerrychain.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.
- This primarily affected the
- 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
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
toregion_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 thebiparition_tree_random
does not have any modifications for region-aware or pair reselection.
Full Changelog: v0.3.0...v0.3.1
v0.3.0
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
- An updater
-
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 therandom
module and set the random seed usingrandom.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 parameterallow_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 torecom
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 theis_valid
property that allows for the printing and editing of constraints. For example. one may print the constraints with the callprint(chain.constraints)
which will print something like[<function single_flip_contiguous at 0x7f3d80f45b20>]
, and the constraints can be set with something likechain.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.
- #235 The MarkovChain class now has an alias
-
#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
v0.2.20
This release contains some bug fixes that were reported for the v0.2.19 release.
What's Changed
- Remove duplicate frozen call in FrozenGraph by @InnovativeInventor in #393
- Fix default updaters bug in GeographicPartition by @InnovativeInventor in #391
Full Changelog: v0.2.19...v0.2.20
v0.2.19
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
- Use slots in Partition by @pjrule in #363
- Add seed and freeze test to loudly detect when breaking changes are made by @InnovativeInventor in #378
- Add neighborhood flips caching by @InnovativeInventor in #373
- More slots by @InnovativeInventor in #374
- Add option to disable cut_edges updater with use_cut_edges flag by @InnovativeInventor in #375
- Replace references to assignment[node] to assignment.mapping[node] to reduce getitem overhead by @InnovativeInventor in #382
- Refactor out Assignment.update (replace with Assignment.update_flows) to prevent double-calculating flows by @InnovativeInventor in #383
- Cache flow_from_changes by @InnovativeInventor in #384
- Simplify Assignment iterators by @InnovativeInventor in #385
- Frozen graph implementation! by @InnovativeInventor in #386
- Add projection information to serialized dual graph. by @jenni-niels in #388
New Contributors
- @jenni-niels made their first contribution in #388
Full Changelog: 0.2.18...v0.2.19
New Seed Partition functions
Same as last release, but with the citation removed because it seems to have been causing issues with twine.
New Seed Partition functions
This release contains need seed partitioning functionality, courtesy of Talia Blum.
Bug fixes
Two major changes in this release:
- 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.
- The default edge finding algorithm is the memoized algorithm now, which should perform better in terms of speed.
Testing Upgrade
0.2.14 add space to README (#349)