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.int64 is rejected so a duration cannot silently take a second convention from the planner’s known limitation.

min_training_periods defaults to 2 to match SyntheticControlPlanner. 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_schedule treats two caller labels that name one history position as one origin and rejects the second use.

Type:

tuple

horizons#

Positive unique Python ints. Each is fitted separately. Prefix reuse is not available.

Type:

tuple of int

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:

tuple

exclusions#

Labels removed from training and holdout. validate_schedule resolves 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:

tuple

cadence#

None takes the next horizon index labels and does not check calendar gaps. An int cadence expects origin + i * cadence on a numeric index. A date frequency must yield exactly horizon strictly increasing unique labels starting at the origin. A zero, negative, or collapsed offset is incomplete, not a shortened holdout. Gaps are recorded, not imputed.

Type:

int, str, pandas offset, or None

min_training_periods#

Minimum pre-origin rows after exclusions. Default 2.

Type:

int

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)#