cleverly.OptimalRuleValue#

class cleverly.OptimalRuleValue(rule: LearnedRule = <factory>, intermediate: float | None = None)[source]#

Request the value of the optimal treatment rule, estimated from rules learned in folds.

The target is a fixed parameter: the mean outcome \(\Psi_{d_0}(P_0)\) had every unit received the arm with the best mean outcome given its covariates, \(d_0(w) = \arg\max_a \bar Q_0(a, w)\). The estimator is the TMLE of LearnedRuleValue, so on the same data and settings the point and the interval are that fit’s, reported under ey_optimal_rule. Van der Laan and Luedtke (2015), Section 7.2, give the conditions under which it estimates the optimal value: the fold rules converge to \(d_0\), the effect is zero for almost no unit (a non-exceptional law), and the rules approach \(d_0\) fast enough that the regret is \(o_P(n^{-1/2})\). Over more than two arms the package reads the second condition as the best arm tying with another for almost no unit, its own step. At an exceptional law nothing is guaranteed, and the interval can under-cover.

The fit runs under either report and in sample (CrossFitting(enabled=False), whose interval needs the Donsker condition C5a of van der Laan and Luedtke 2015, Theorem 5). With weights= on the design the target is the optimal value of the population the weights describe, whose optimal rule can differ from the unweighted one; with strata= each stratum reports its own optimal value beside the marginal one; with intermediate=z the target is the value of the best treatment with the intermediate held at z. The fold-evaluated fit on rows with known treatment probabilities (treatment_probabilities=) reads supported, from the learned-rule-optimal-value study, and so does such a fit with one of those compositions, or known regimes beside it, from the learned-rule-optimal-compositions study (the in-sample fit with a parametric outcome learner); every other fit, an estimated treatment mechanism among them, reads experimental. Under weights the probabilities must be the weighted population’s own, which the label cannot check.

Parameters:
ruleLearnedRule

The rule class whose fold rules estimate the optimal rule, and the label the reported parameter carries.

intermediatefloat or None

The level, 0.0 or 1.0, at which a declared binary intermediate is held: the target is \(E_0\bar Q_0(d^z_0(W), z, W)\) with \(d^z_0(w) = \arg\max_a \bar Q_0(a, z, w)\). Required on a design with an intermediate and refused on one without.

See also

LearnedRuleValue

The value of the learned rules themselves, a data-adaptive target.

cleverly.interventions.LearnedRule

The rule this estimand holds.

Examples

>>> from cleverly import OptimalRuleValue
>>> estimand = OptimalRuleValue()
>>> estimand.name, estimand.rule.name
('ey_optimal_rule', 'learned rule')

Methods#

Attributes#

OptimalRuleValue.definition: str = 'value of the optimal rule, which gives each unit the arm with the best mean outcome given its covariates'#
OptimalRuleValue.intermediate: float | None = None#
OptimalRuleValue.name: str = 'ey_optimal_rule'#
OptimalRuleValue.rule: LearnedRule#