cleverly.longitudinal.SurvivalSelection#
- class cleverly.longitudinal.SurvivalSelection(arm: str, horizon: int, moves: tuple[tuple[str, str] | None, ...], g1_terms: tuple[tuple[str, ...], ...], g2_terms: tuple[tuple[str, ...], ...], n_steps: tuple[int, ...], train_loss: NDArray[float64], train_penalty: NDArray[float64], train_risk: NDArray[float64], cv_risk: NDArray[float64], converged: tuple[bool, ...], clipped: tuple[int, ...], dropped_terms: tuple[int, ...], selected: int, penalized: bool, folds: Folds, covariates: tuple[str, ...], diagnostic_horizon: int, fold_held_nodes: tuple[tuple[int, int, str], ...] = (), target_solves: tuple[int, ...] = (), candidate_pairs: tuple[int, ...] = (), penalty_form: str = 'printed_24', combination: str = 'sum_loss_plus_penalty')[source]#
The collaborative selection of one arm at one horizon.
- Parameters:
- arm
str The regimen label.
- horizon
int The horizon, counted from one.
- moves
tuple The move of each path position:
Noneat \(M_0\), then("g1", term)or("g2", term).- g1_terms
tupleoftupleofstr The treatment-model covariates at each position.
- g2_terms
tupleoftupleofstr The censoring-model terms at each position, beside the node indicators.
- n_steps
tupleofint The restarts the search had made when it reached each position.
- train_loss
FloatArray The selection loss of each position on the full data.
- train_penalty
FloatArray The penalty (24) of each position on the full data, zero without a penalty.
- train_risk
FloatArray Their sum.
- cv_risk
FloatArray The cross-validated penalized risk of each move count, summed over the folds. It chooses
selected.- converged
tupleofbool Whether each position’s targeting solve converged on the full data.
- clipped
tupleofint The person-nodes whose hazard the loss clip moved at each position.
- dropped_terms
tupleofint The terms each position’s two fits aliased with earlier columns.
- selected
int The position the cross-validated risk chose, the first of ties.
- penalizedbool
Whether the risk adds the penalty.
- penalty_form
str "printed_24": the printed (24) of the source, not the influence-curve variance.- combination
str "sum_loss_plus_penalty": the loss summed over the scored rows plus the penalty.- folds
Folds The realized selection split, with its origin.
- fold_held_nodes
tupleoftuple (fold, node, kind)of each censoring node a selection fold held rather than fitted:"no_censoring"at retention one,"all_censored"at retention1e-12.- covariates
tupleofstr The baseline covariates the search drew from, in data order.
- diagnostic_horizon
int The horizon whose selections
result.mechanismreports.- target_solves
tupleofint The hazard targeting solves of the search: the full-data path first, then each selection fold’s path. One per scored candidate position, so it counts the work the greedy search did, restarts included.
- candidate_pairs
tupleofint The distinct candidate pairs of mechanisms each of those paths targeted. Regimens on one arm share its search and report the same counts.
- arm
Methods#
- SurvivalSelection.summary(*, detail: Detail = 'short') Summary[source]#
A printable report of the selection path.
- Parameters:
- detail{“short”, “full”},
default“short” Accepted for symmetry with the other records; both print the same.
- detail{“short”, “full”},
- Returns:
SummaryThe path, one row per position, and the chosen position.
Attributes#
- SurvivalSelection.move_labels#
The move of each path position in words:
"M0", then"+<term> in <g1|g2>".
- SurvivalSelection.selected_terms#
The treatment-model covariates and the censoring-model terms of the selected position.
- SurvivalSelection.train_loss: NDArray[float64]#
- SurvivalSelection.train_penalty: NDArray[float64]#
- SurvivalSelection.train_risk: NDArray[float64]#
- SurvivalSelection.cv_risk: NDArray[float64]#