mapselect
Uncertainty at the places a map selects.
Machine-learning maps rank places, and a rule picks some of them: the highest carbon stock, the poorest villages in each country,
the most valuable sites within a travel budget. Intervals that are valid on average are often wrong at exactly those places.
mapselect calibrates each selected place only on audited places that the same rule would have selected, and tells you before any
field work how large the audit has to be.
import numpy as np
import mapselect as ms
# mu: the map's prediction; audited / candidates: a random split of one population; y known at audited places
sel = ms.top_k(mu[audited], mu[candidates], K=30)
scores = np.abs(y[audited] - mu[audited]) / sigma[audited]
q = ms.jomi(scores, sel, alpha=0.1) # may be +inf if too few audited places lie past the cutoff
J = candidates[sel.selected]
lower, upper = mu[J] - q * sigma[J], mu[J] + q * sigma[J]
ms.plan.n_for_finite(m=3000, K=30) # audited places for a 0.9 chance of finite intervals
ms.plan.n_budget_for_finite(population=300, K=30) # the same when the audit is drawn from the map's top 300 places
| Task | Function | Guarantee |
|---|---|---|
| Rules | top_k, quota, budget, publication_mask, threshold, within_groups |
closed-form reference sets, checked against literal swaps |
| Intervals at selected places | jomi |
coverage at least 1 − α among selected places, on average over audits |
| Coverage within regions (RegionCP) | regioncp (also sc_geoccp), basis.Multiscale |
Theorem 1's floors, which may be vacuous |
| Project totals | exact_lower_total |
finite sample |
selection_aware_total, vcs_credit |
asymptotic; the protocol rule itself | |
| Funding | cfbh |
false discovery rate at most q, for a top- or bottom-K rule without tied scores (checked) |
| Audit size | plan.p_finite, plan.n_for_finite, plan.n_budget_for_finite, plan.floor, plan.n_for_floor |
no outcomes used |
| Any other rule | bruteforce.reference_matrix |
literal swaps; slow |
What the guarantees need. A random audit of one finite population (or of a stratum fixed by the map in advance), a map fitted separately, and a rule that uses covariates alone and treats audited places symmetrically. Rules that look at audited outcomes, audits that are not random, and transfer to unsampled regions fall outside them. Coverage holds on average over audits, and counts infinite intervals as covering.
cfbh accepts only top_k selections (either direction) with one shared reference set and distinct scores. It rejects
quota selections even when only one group is selected. An empty supported selection returns empty p-values and rejections.
Install. pip install . from this folder (not yet on PyPI; RELEASE.md has the steps). Needs numpy and scipy; pip install .[basis] adds scikit-learn for basis.Multiscale.
Tests. python -m pytest tests.
Status. Version 0.1.0, not yet on PyPI. Licence: MIT. Citation: [manuscript to record].
Performance
One core of an Apple M6 laptop, synthetic data (experiments/run_package_benchmark.py in the project; results/fia_db/RESULTS_PACKAGE_BENCHMARK.md).
| Task | Size | Time | Memory |
|---|---|---|---|
| Top-1% rule, thresholds | 10⁸ candidates, 10⁷ audited | 1.4 s | 2.5 GB |
| Quota, 50 groups | same | 40 s | 5.7 GB |
| Budget | same | 35 s | 6.9 GB |
| Publication mask, k-d tree, selection only | 10⁶ audited | 2 min | 2.2 GB |
| RegionCP, later units (one reference set) | 10⁵ reference units, 60 basis functions | 0.036 s per unit | 0.9 GB |
| Exact total bound | 10⁴ selected | 25 s | 0.2 GB |
At small sizes these gains shrink or vanish: at 10³ reference units the active set is 1.6 times faster than the full dual, and the budget rule is no faster than a careful per-unit loop up to 10⁵ candidates.
Metadata
Release files for mapselect 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mapselect-0.1.0.tar.gz | 24.8 kB | With provenance | Details for mapselect-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mapselect-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for mapselect-0.1.0-py3-none-any.whl |
Total release size: 46.7 kB
Release files / mapselect-0.1.0.tar.gz
| Download URL | mapselect-0.1.0.tar.gz |
|---|---|
| Size | 24.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d4255d5484bf95e46316f209219cfba7865f5cfd0a8da36abaab879ed779ff7
|
|
BLAKE2b-256 checksum How to use checksums |
337d04b8cd4719ce030202e24e44c6621276b59c31798fcc0c71d50113e56056
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.
Transparency logRelease files / mapselect-0.1.0-py3-none-any.whl
| Download URL | mapselect-0.1.0-py3-none-any.whl |
|---|---|
| Size | 21.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
88b23644c25c8b99285dd510ee8ca2754e46ed3f5688661df67c2f51f05d058b
|
|
BLAKE2b-256 checksum How to use checksums |
a9bc9c0c82696df1cc6ff367208568e36876713aca01da59af5f88bd23d569a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.
Transparency logSecurity for mapselect 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mapselect-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.