Answer prose round 1: one name for a place holding most of a postal code's land, the decision leaves the seeding to the code, and the test says what it checks
This commit is contained in:
@@ -129,7 +129,7 @@ def localities(cache, counties):
|
||||
|
||||
def drawn(places, share):
|
||||
"""The share of the places with people, each drawn with odds by its population: Efraimidis and Spirakis's weighted
|
||||
sampling without replacement. Each place's random number is seeded by its code, so a place added or dropped from
|
||||
sampling without replacement. Each place's random number is seeded by its code, so a place added to or dropped from
|
||||
the sources moves only the places near the cut."""
|
||||
peopled = [code for code, p in places.items() if p["population"] > 0]
|
||||
key = {code: math.log(1 - random.Random(code).random()) / places[code]["population"] for code in peopled}
|
||||
|
||||
+2
-2
@@ -64,8 +64,8 @@ class Nearest:
|
||||
|
||||
|
||||
def top_streets(count, share, minimum, column):
|
||||
"""count maps (locality, street name) to a count. Returns, per locality, rows for the share of its names counted
|
||||
most, at least minimum of them, ties broken by name; each row holds its count under column."""
|
||||
"""count maps (locality, street name) to a count. Returns, per locality, rows for its most-counted names, share of
|
||||
them rounded up and at least minimum, ties broken by name; each row holds its count under column."""
|
||||
of = collections.defaultdict(list)
|
||||
for (locality, name), n in count.items():
|
||||
of[locality].append((n, name))
|
||||
|
||||
Reference in New Issue
Block a user