Skip to content

Docs/polish round 1 1p0p0 - #466

Merged
peterrrock2 merged 18 commits into
1.0.0from
docs/polish-round-1-1p0p0
Jul 29, 2026
Merged

Docs/polish round 1 1p0p0#466
peterrrock2 merged 18 commits into
1.0.0from
docs/polish-round-1-1p0p0

Conversation

@peterrrock2

Copy link
Copy Markdown
Collaborator

Summary

Documentation polish ahead of the 1.0.0 release, working through the review notes from PR #464 and the follow-up email thread with @chief-dweeb.

No library behavior changes. The two files touched under gerrychain/ change only a comment and docstring cross-reference roles.

Changes

  • Fixed the docs build.
  • Added a "Changes to ReCom Proposals" section to the migration guide covering the ReCom namespace.
  • Documented the MarkovChain parameter renames (proposal, accept, initial_state) and corrected the section that claimed no legacy changes were needed (this will be updated again later when I get the deprecation shims in).
  • Restored the ReCom demo animation, and made it reproducible. gerrychain_demo.gif had been overwritten with a copy of the plain ensemble gif, losing the spanning-tree and cut-edge frames. generate_recom_assets.py can now render it.
  • Expanded the Multi-Member ReCom section of recom.ipynb.
  • Made the region-aware ensemble readable in one picture. The "Multiple Regions at Once" ensemble now renders with each municipality boxed in black and the water district boundaries in white, on top of the district colors, so it is obvious which regions survived a given plan.
  • Corrected surcharge wording in recom.ipynb
  • Title-cased the user guide headings and reflowed the migration guide to 100 columns (via mdformat + my editor settings)
  • Removed the orphaned rx_migration_guide.md and a dead test helper.

Testing

  • Tests pass locally
  • Manually tested relevant behavior
  • Docs build cleanly (make docs, warnings-as-errors)

make test reports 456 passed, 10 skipped, 2 xfailed.

Reviewer Notes

  • The library's own docstrings referenced four properties with :meth:, so the rendered API docs described nodes, edges, node_indices, and edge_indices as callables. Fixed by properly tagging these as :attr: in the docstrings.
  • Please let me know what you think about the new viz for the multi-region ensemble.

@chief-dweeb chief-dweeb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great - some nits in my comments.

-Fred

Comment thread docs/topics/v1p0p0_migration_guide.md Outdated
Comment on lines +242 to +244
One other addition worth knowing: MarkovChain() now takes an `rng` argument (an integer seed or a
`random.Random`), and the chain's RNG is passed to your proposal and acceptance functions. This is
what makes runs reproducible. There is more on this in the reproducibility guide.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit - it might be nice to just say that "RNG" stands for random number generator...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair. I'll add that

Comment thread docs/topics/v1p0p0_migration_guide.md Outdated
Comment on lines +269 to +270
Instead of the `partial` incantation, v1.0.0 provides slim, ready-made builders that provide a
simple interface to return a proposal function directly:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not use "instead" as it implies that the old way is gone. I would also add a brief note about why we added the new (equivalent) approach - something along the lines of 1) some users found the use of "partial" hard to understand and 2) the new approach is just more readable.

Comment on lines +282 to +287
The variants differ along two axes. `district_pairs_*` picks uniformly among adjacent district
pairs, while `cut_edges_*` picks a cut edge at random and merges the districts on either side, so a
pair's chance is proportional to how many cut edges it shares. `*_mst` draws a minimum spanning tree
over random edge weights using Kruskal's algorithm; `*_ust` draws a uniform spanning tree using
Wilson's algorithm. `ReCom.reversible(...)` is Reversible ReCom. The single-letter aliases `A`, `B`,
`C`, `D`, and `R` are also available.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would list the variants here before talking about them. Something like:

There have always been several ways to run ReCom, and we have provided specific variants for these:

<table with names and brief descriptions>

As you can see, these variants differ in two ways:

> methods. Note also that the old class's `ideal_pop` parameter is spelled `pop_target` throughout
> v1.0.0.

When you need parameters the slim builders do not expose, use `build_recom_proposal_fn`, which takes

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Comment on lines +312 to +319
If you pass any of these by keyword, they need updating:

| Legacy name | v1.0.0 name | Where |
| ----------------- | ---------------------------- | -------------------------------------- |
| `method` | `bipartition_tree_fn` | `recom` |
| `balance_edge_fn` | `find_balanced_edge_cuts_fn` | `bipartition_tree` |
| `one_sided_cut` | `single_district_cut` | `bipartition_tree`, custom cut finders |
| `choice` | `cut_choice_fn` | `bipartition_tree` |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Comment on lines +373 to +387
`MultiMemberReCom` offers the same four non-reversible variants as `ReCom`, plus
`build_multi_member_recom_proposal_fn` for the full parameter set. Three things differ from the
single-member case:

- `pop_target` is the population for a _single member_, so it is the total population divided by the
total number of members, not by the number of districts.
- Member counts attach to district labels and stay fixed for the whole run. The keys of
`members_per_district` must match the partition's district labels exactly, and every count must be
a positive integer.
- The equal-population constraint is not appropriate, since districts are deliberately unequal in
size. Use `within_percent_of_ideal_population_per_member` instead.

There is no reversible multi-member variant, and no random multi-member seed generation yet; build a
starting plan by merging single-member districts. The [ReCom user guide](../user/recom.ipynb) has a
worked example.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Comment thread docs/user/recom.ipynb
Comment on lines +532 to +535
"Surcharges are best read against the random weights they compete with, which are drawn from\n",
"$[0,1)$. A surcharge of 0.1 only reorders edges whose random weights happen to land within\n",
"0.1 of each other, so it is a very weak bias. In this example, values from roughly 0.3 upward are \n",
"where the effect becomes easier to observe."

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice - thanks

Comment thread docs/user/recom.ipynb
"\n",
"### How Member Counts Work in the Code\n",
"\n",
"A key distinction between the standard ReCom and Multi-Member ReCom is that in the Multi-Member\n",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice explanation.

Grammar nit - you state "if you declare that districts 1 and 2 to both have 1 member..." I think you should lose the word, "that", so it reads "if you declare districts 1 and 2 to both have 1 member..."

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! And good catch; I will make that change.

Comment thread docs/user/recom.ipynb Outdated
"\n",
"### Setting Up the Initial Partition\n",
"\n",
"There are two things are worth keeping separate: \n",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammar nit: instead of" "There are two things are worth keeping separate:" I think you want: "There are two things worth keeping separate: \n". That is, change "are worth" to just "worth"...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted. Will fix. Thanks!

@peterrrock2

Copy link
Copy Markdown
Collaborator Author

Great! Thank you for catching my grammar in this. I'm moving a bit fast right now, so I have not spent as much time polishing as I usually do. I'll make these changes, merge them in, update the branches, and send you an email when I have finished. Expect something within the next hour.

@peterrrock2
peterrrock2 merged commit c777f36 into 1.0.0 Jul 29, 2026
1 check passed
@peterrrock2
peterrrock2 deleted the docs/polish-round-1-1p0p0 branch July 29, 2026 16:20
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

Successfully merging this pull request may close these issues.

2 participants