ScheduleRequest#
- class causalpy.historical_validation.ScheduleRequest[source]#
Validated historical-schedule contract.
Selection origins and audit origins are separate. Audit origins must sit strictly after every selection origin in the history index; an earlier audit is not untouched. Horizons are Python ints because each origin and horizon is a separate fit.
np.int64is rejected so a duration cannot silently take a second convention from the planner’s known limitation.min_training_periodsdefaults to 2 to matchSyntheticControlPlanner. That floor is not a universal statistical minimum.- selection_origins#
Origins used to score bias and, when defensible, to feed the learned-null model. Required.
validate_scheduletreats two caller labels that name one history position as one origin and rejects the second use.- Type:
- horizons#
Positive unique Python ints. Each is fitted separately. Prefix reuse is not available.
- audit_origins#
Later origins reserved as an untouched audit. They are planned and not fitted unless replay is asked to fit them. Fitting an audit origin means it is no longer untouched.
- Type:
- exclusions#
Labels removed from training and holdout.
validate_scheduleresolves each label to the index’s own label before membership, so a date string that names a timestamp is excluded rather than left in the fitted window. A holdout exclusion makes that window incomplete. Unknown labels are a contract error.- Type:
- cadence#
Nonetakes the nexthorizonindex labels and does not check calendar gaps. An int cadence expectsorigin + i * cadenceon a numeric index. A date frequency must yield exactlyhorizonstrictly increasing unique labels starting at the origin. A zero, negative, or collapsed offset is incomplete, not a shortened holdout. Gaps are recorded, not imputed.
- missing_data#
The only supported policy. Non-finite outcomes mark the window incomplete and are not imputed.
- Type:
{‘reject’}
- training_policy#
The only supported policy. Training is every non-excluded observation strictly before the origin. It is an expanding prefix, not a rolling window, so later origins share earlier training history.
- Type:
{‘pre-origin-only’}
Methods
Attributes
- __init__(selection_origins, horizons, audit_origins=(), exclusions=(), cadence=None, min_training_periods=2, missing_data='reject', training_policy='pre-origin-only')#
- Parameters:
- Return type:
None
- classmethod __new__(*args, **kwargs)#