cleverly.longitudinal.LearnedRegimenNode#
- class cleverly.longitudinal.LearnedRegimenNode(node: int, treatment: str, arms: tuple[str, str], treated_shares: tuple[float, ...], gap_quantiles: tuple[tuple[float, ...], ...], rule_disagreement: float)[source]#
Record one decision node of a learned regimen: what its fold rules did.
- Parameters:
- node
int The decision node, counted from one.
- treatment
str The node’s treatment column.
- arms
tupleofstr The node’s two treatment levels in arm-code order; the rule treats with the second.
- treated_shares
tupleoffloat For each fold, the share of its validation rows at risk at this node under the fold’s own rule pair that the fold’s rule treats. At the first node every row is at risk.
- gap_quantiles
tupleoftupleoffloat For each fold, quantiles of the absolute blip behind the rule on the same rows, at
LEARNED_REGIMEN_QUANTILE_LEVELS, on the scale the regressions are fitted on. Mass near 0 speaks against the margin condition of a fixed rule limit.- rule_disagreement
float The share of rows at which the fold rules do not all assign the same arm, read from every fold’s rule on every row (at the second node, on the rows uncensored after the first node). At the second node a fold’s code is the second rule of the first-node arm that fold chose, so the share also counts rows whose folds chose different first-node arms. Rules that settle to one limit agree almost everywhere.
- node