audit_sensitivity¶
audit_sensitivity
¶
audit_sensitivity(stations: DataFrame, grids: dict[str, list], *, a7_scope: str = 'docked', **baseline: Any) -> DataFrame
One-at-a-time threshold sensitivity of the A1–A7 audit.
For each (parameter, value) in grids, re-run audit_static with
that single threshold changed (the others held at their baseline) and report,
per class, the number of flagged systems and the Jaccard overlap of the
flagged-system set against the baseline audit. Deterministic (no sampling), so
it is the reproducible backbone of a threshold-robustness analysis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stations
|
DataFrame
|
Canonical station inventory (see |
required |
grids
|
dict[str, list]
|
Maps an |
required |
a7_scope
|
('docked', 'all')
|
Held fixed across the sweep. |
"docked"
|
**baseline
|
Any
|
Threshold keywords defining the baseline audit (defaults reproduce the published verdicts). |
{}
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Columns |
See Also
audit_static : The single audit this sweeps one threshold at a time.
flag_rate_ci : The complementary sampling-based uncertainty on flag rates.
Examples:
>>> import pandas as pd
>>> stations = pd.DataFrame({
... "system_id": "s", "station_id": [str(i) for i in range(20)],
... "station_type": "docked_bike",
... "capacity": [float("nan")] * 12 + [10.0] * 8,
... "lat": 48.85, "lon": 2.35,
... })
>>> sens = audit_sensitivity(stations, {"a7_tau": [0.5, 0.7]}, a7_scope="all")
>>> sens[sens["class"] == "A7"]["systems_flagged"].tolist()
[1, 0]