SyntheticControlPlanner.search#
- SyntheticControlPlanner.search(durations, selection_origins, *, treated_unit=None, eligible_units=None, donor_pools=None, include=None, exclude=(), spillover_exclude=(), min_donors=1, costs=None, max_cost=None, outcome_share=None, representativeness=None, min_representativeness=None, group_size=1, shortlist_size=8, max_screened=None, screen_holdout=4, audit_origins=(), relative_lifts=None, absolute_lifts=None, target_lift, target_scale=None, exclusions=(), cadence=None, max_fits=24, fit_cost=None, min_training_periods=2, sample_kwargs=None)[source]#
Screen a declared candidate space and fit the shortlist.
Fixed-target search is the default: the constructor’s treated unit, or
treated_unitwhen passed, paired withdonor_poolsor the planner’s control units. Free-target search passeseligible_unitsand no treated unit. Passing both is an error. Group size must be 1.Screening is a deterministic weighted-proportion holdout RMSE on rows strictly before the earliest selection origin. Correlation, maximum weight, and concentration are diagnostics, not vetoes. The shortlist keeps boundary candidates (lowest cost, highest relevance, lowest and highest outcome share, lowest proxy score), then fills by proxy rank. Ties break on candidate id. Input order is not the policy. The shortlist is fitted in candidate-id order, and budget exhaustion follows that order. The default shortlist size is 8. A larger screened set is not silently truncated to the first rows; set
max_screenedto cap screening by a stable candidate-id hash, which is disclosed.Each shortlist member is fitted by
compare_durations()with a seed keyed to the candidate, and each window fit uses a seed keyed to that candidate and the origin. Both derive from the planner’srandom_seedand do not depend on loop order.sample_kwargsmust not containrandom_seed. Audit origins stay reserved. Budget exhaustion stops the shortlist in candidate-id order and leaves the remainder unfinished; it does not select a winner.- Parameters:
durations (
Sequence[int]) – Same contract ascompare_durations().selection_origins (
Sequence[Any]) – Same contract ascompare_durations().treated_unit (
str|None) – Fixed-target unit. Defaults to the constructor target. A sequence is a group request and raises.eligible_units (
Sequence[str] |None) – Free-target units. Each is paired with the other eligible units, or with the single supplied donor pool, after exclusions.donor_pools (
Sequence[Sequence[str]] |None) – Fixed-target alternatives. One pool in free-target mode is applied to every target. Pools are sorted and filtered; the target is never its own donor.include (
Sequence[str] |None) – Inclusion and exclusion lists. Spillover buffers are removed from both arms and cannot be targets. The lists must be disjoint and name units in the history.exclude (
Sequence[str]) – Inclusion and exclusion lists. Spillover buffers are removed from both arms and cannot be targets. The lists must be disjoint and name units in the history.spillover_exclude (
Sequence[str]) – Inclusion and exclusion lists. Spillover buffers are removed from both arms and cannot be targets. The lists must be disjoint and name units in the history.min_donors (
int) – Candidates with fewer donors after exclusions are skipped.costs (
Mapping[str,float] |None) – Supplied additive cost of the treated unit. Donors are not charged. A missing key for a candidate target raises before fitting.max_cost (
float|None) – Skip a target whose supplied cost exceeds this value. Requirescosts.outcome_share (
tuple[float,float] |None) –(min, max)bounds on the target’s share of selection-history outcome across the eligible universe. A non-positive total raises. This is not inferred from correlation.representativeness (
Mapping[str,float] |None) – Supplied score. It is not inferred. A missing candidate key raises.min_representativeness (
float|None) – Skip a target below this supplied score. Requiresrepresentativeness.group_size (
int) – Must be 1. Any other value raises.shortlist_size (
int) – Maximum number of screened candidates passed to the duration comparison. Boundary candidates are reserved first.max_screened (
int|None) – Cap on how many candidates that already pass include, exclude, spillover, donor, cost, share, and representativeness constraints receive a proxy score. Infeasible candidates are removed before the cap, so a hash-first failure cannot discard every feasible design. The kept set is a stable hash order, not input order, and the cap is disclosed.screen_holdout (
int) – Trailing selection-history rows used for the proxy RMSE. At least two earlier training rows are required; otherwise the candidate is screen-failed.audit_origins (
Sequence[Any]) – Same contract ascompare_durations().relative_lifts (
Sequence[float] |None) – Same contract ascompare_durations().absolute_lifts (
Sequence[float] |None) – Same contract ascompare_durations().target_lift (
float) – Same contract ascompare_durations().target_scale (
str|None) – Same contract ascompare_durations().exclusions (
Sequence[Any]) – Same contract ascompare_durations().cadence (
Any) – Same contract ascompare_durations().max_fits (
int) – Total inference budget for the shortlist, not a per-candidate reset. The default of 24 can exhaust before a long shortlist finishes; that result is partial evidence.fit_cost (
float|None) – Same contract ascompare_durations().min_training_periods (
int) – Same contract ascompare_durations().sample_kwargs (
dict[str,Any] |None) – Same contract ascompare_durations(). Must not containrandom_seed; candidate seeds are derived from the planner seed.
- Returns:
Screened, skipped, failed, and unfinished candidates, the evaluated comparisons, and the Pareto set across historical detection share and any supplied cost or relevance axis.
global_optimumis false.recommendationwithholds launch.freezedelegates to one evaluated comparison and does not consult the others. Recall and regret are present only when every screened candidate was fitted.- Return type:
SearchResult