cleverly.interventions.LearnedRuleRecord#
- class cleverly.interventions.LearnedRuleRecord(name: str, fold_sizes: tuple[int, ...], fold_estimates: tuple[float, ...], treated_shares: tuple[float, ...], blip_quantiles: tuple[tuple[float, ...], ...])[source]#
Record what a learned-rule fit estimated, under
result.extra["learned_rule"].The fitted fold models are not kept. The realized rule of each row is
result.nuisance.regimes.values[:, 1, 0], and the folds, the learner templates and the seeds replay the fit.- Parameters:
- name
str The label of the rule.
- fold_sizes
tupleofint The validation rows of each outer fold.
- fold_estimates
tupleoffloat The targeted plug-in value of each fold on its own validation rows.
- treated_shares
tupleoffloat The share of each fold’s validation rows that its rule assigns to the higher arm code.
- blip_quantiles
tupleoftupleoffloat For each fold, quantiles of the estimated blip
Qbar_v(1, W) - Qbar_v(0, W)on its validation rows, atquantile_levels, on the scale the outcome regression is fitted on.
- name
- Attributes:
n_foldsintReturn the number of outer folds.
fold_weightstupleoffloatReturn the weight of each fold in the reported average,
1/Vfor every fold.rulestrReturn the rule class, in words (
RULE_CLASS).targetstrReturn what the reported value is (
TARGET_KIND).quantile_levelstupleoffloatReturn the levels of
blip_quantiles(BLIP_QUANTILE_LEVELS).
Methods#
Attributes#
- LearnedRuleRecord.fold_weights#
Return the weight of each fold in the reported average,
1/Vfor every fold.
- LearnedRuleRecord.n_folds#
Return the number of outer folds.
- LearnedRuleRecord.quantile_levels#
Return the levels of
blip_quantiles(BLIP_QUANTILE_LEVELS).
- LearnedRuleRecord.rule#
Return the rule class, in words (
RULE_CLASS).
- LearnedRuleRecord.target#
Return what the reported value is (
TARGET_KIND).