cleverly.longitudinal.LongitudinalRepeat#

class cleverly.longitudinal.LongitudinalRepeat(folds: Folds, seed: int | None, fits: dict[str, RegimenFit], mechanism: Mechanism, estimates: dict[str, ParameterEstimate], replay_recipe: _LongitudinalReplayRecipe, msm_fits: tuple[MSMRegimenFit, ...] = (), fold_mechanisms: tuple[FoldMechanism, ...] = (), isotonic_moves: tuple[tuple[str, str | None, int, float, float], ...] = (), initial_hazards: InitialHazards | None = None, learned_regimen: LearnedRegimenRecord | None = None)[source]#

One draw of the cross-fitting split of a longitudinal fit, and what it produced.

A fit with repeats=R holds R of these in LongitudinalResult.repeats. Each is the complete single-draw fit at its own fold assignment and seed, so draw r equals a fit with repeats=1 at random_state=seed.

Parameters:
foldsFolds

The realized outer-fold assignment of the draw.

seedint or None

The seed of the draw’s split. On a fit with repeats > 1 every learner of the draw receives it too. None only on an in-sample fit.

fitsdict of str to RegimenFit

The draw’s sequential fits by regimen, cause and horizon.

mechanismMechanism

The draw’s fitted treatment and observation mechanisms.

estimatesdict of str to ParameterEstimate

Every estimate the draw reports, with its influence curve and its own status.

replay_recipeobject

The draw’s unfitted learner templates and resolved plans, for a truncation replay.

msm_fitstuple of MSMRegimenFit

The draw’s projection fits by cause, empty without a working model.

fold_mechanismstuple of FoldMechanism

The draw’s per-fold mechanisms on a cross-fitted SDR or IPSI fit, empty otherwise.

isotonic_movestuple of tuple

The levels an isotonic=True projection moved, as (regimen, cause, horizon, before, after).

initial_hazardsInitialHazards or None

The initial cause-specific hazards of a survival_model="hazard" fit.

learned_regimenLearnedRegimenRecord or None

The fold rules of a LearnedRegimen fit, and None on every other fit.

Methods#

Attributes#

LongitudinalRepeat.fold_mechanisms: tuple[FoldMechanism, ...] = ()#
LongitudinalRepeat.initial_hazards: InitialHazards | None = None#
LongitudinalRepeat.isotonic_moves: tuple[tuple[str, str | None, int, float, float], ...] = ()#
LongitudinalRepeat.learned_regimen: LearnedRegimenRecord | None = None#
LongitudinalRepeat.msm_fits: tuple[MSMRegimenFit, ...] = ()#
LongitudinalRepeat.folds: Folds#
LongitudinalRepeat.seed: int | None#
LongitudinalRepeat.fits: dict[str, RegimenFit]#
LongitudinalRepeat.mechanism: Mechanism#
LongitudinalRepeat.estimates: dict[str, ParameterEstimate]#
LongitudinalRepeat.replay_recipe: _LongitudinalReplayRecipe#