Second-Pass Screening (rescreen)#
After locking optimized parameters from the main calibration pipeline, second-pass Morris screening tests whether previously fixed parameters become important when the primary ones are held at their optimal values.
This implements Lesson L3 (calibration order matters): behavioral parameters first, structural second, with second-pass Morris to confirm sensitivity collapse.
CLI Usage#
# Screen structural params after locking the behavioral winner
python -m calibration --phase rescreen --scenario growth_plus \
--fix-from output/growth_plus_stability.json --params initial_conditions
# Screen a comma-separated list of specific params
python -m calibration --phase rescreen --scenario baseline \
--fix-from output/baseline_stability.json --params beta,max_M
Required flags:
--fix-from: Path to stability result JSON (loads #1-ranked config)--params: Parameter group name (fromPARAM_GROUPS) or comma-separated names
Python API#
from calibration.rescreen import run_rescreen, compute_sensitivity_collapse
result, collapse = run_rescreen(
scenario="baseline",
fix_from=Path("output/baseline_stability.json"),
params=["price_init", "min_wage_ratio"],
n_seeds=5,
)
for name, data in collapse.items():
print(f"{name}: {data['collapse_pct']:.1f}% collapse")
API Reference#
Second-pass Morris screening after locking optimized params.
Delegates to run_morris_screening(fixed_params=...) and computes
the sensitivity collapse between Phase 1 and Phase 2 Morris results.
- calibration.rescreen.resolve_params(params_str)[source]
Resolve a param group name or comma-separated param names.
- Parameters:
params_str (
str) – Either a PARAM_GROUPS key (e.g., “entry”, “behavioral”) or comma-separated full parameter names (e.g., “beta,max_M”).- Returns:
List of parameter names.
- Return type:
list[str]- Raises:
ValueError – If the string is not a known group and doesn’t look like param names.
- calibration.rescreen.load_fixed_from_result(path)[source]
Load the #1-ranked result’s params from a stability result file.
- Parameters:
path (
Path) – Path to stability result JSON.- Returns:
Parameter dict from the top-ranked result.
- Return type:
dict[str,Any]
- calibration.rescreen.compute_sensitivity_collapse(phase1, phase2)[source]
Compute sensitivity collapse between two Morris screenings.
- Parameters:
phase1 (
MorrisResult) – First-pass Morris result (before locking params).phase2 (
MorrisResult) – Second-pass Morris result (after locking params).
- Returns:
Per-parameter dict with phase1_mu_star, phase2_mu_star, collapse_pct.
- Return type:
dict[str,dict]
- calibration.rescreen.run_rescreen(scenario, fix_from, params, n_trajectories=20, n_seeds=5, n_periods=1000, n_workers=10, phase1_morris=None)[source]
Run second-pass Morris screening on a subset of params.
- Parameters:
scenario (
str) – Scenario name.fix_from (
Path) – Path to stability result JSON to load fixed params from.params (
list[str]) – Parameter names to screen (the rest are fixed).n_trajectories (
int) – Number of Morris trajectories.n_seeds (
int) – Seeds per evaluation.n_periods (
int) – Simulation periods.n_workers (
int) – Parallel workers.phase1_morris (
MorrisResult, optional) – Phase 1 Morris result for collapse comparison.
- Returns:
(phase2_result, collapse_table)
- Return type:
tuple[MorrisResult,dict]
- calibration.rescreen.run_rescreen_phase(args, run_dir=None)[source]
CLI entry point for rescreen phase.