cleverly.interventions.check_policy_support#
- cleverly.interventions.check_policy_support(policies: PolicySet, density: ConditionalDensity | MixedDensity | None, treatment: ndarray[tuple[Any, ...], dtype[float64]], *, propensity: ndarray[tuple[Any, ...], dtype[float64]] | None = None, mechanisms: Sequence[ndarray[tuple[Any, ...], dtype[float64]]] = (), absolute_score_weights: ndarray[tuple[Any, ...], dtype[float64]] | None = None, equations: tuple[str, ...] = (), n_repeats: int = 1, folds: Folds | None = None, declared_support: tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]] | None = None) dict[str, PolicySupport][source]#
Per-policy overlap, in the vocabulary
cleverly.interventions.supportuses.The quantity a policy’s positivity rests on is not a propensity but the ratio \(g^d(a \mid w) / g(a \mid w)\): it is what multiplies each residual, so its tail is where one row starts to dominate the estimating equation. A randomized policy’s ratio is the weighted mean of its components’ ratios.
mechanismsare the further(n, C + 1)denominators a fit declared – the missingness mechanism underdelta=, the intermediate density underintermediate=– of which only column0, the value at the row’s own dose, is read here. The weight the estimating equation forms is \(h_r(A, W) / \{\pi(A, W) q_z(A, W)\}\), so the two reweightings multiply and an effective sample size taken of the ratio alone understates the strain –cleverly.sensitivity.positivitymakes the same argument about1 / gand a population weight. Passing nothing reports the ratio by itself, which is what a fit with no such mechanism means.- Parameters:
- policies
PolicySet The evaluated policies to report on.
- density
ConditionalDensity,MixedDensityorNone The estimated density the ratios were built from, on a continuous treatment.
- treatment
ndarray (n,)observed dose, or level code on a categorical treatment.- propensity
ndarrayorNone (n, K)fitted probabilities, on a categorical treatment.- mechanismssequence
ofndarray Further
(n, C + 1)denominators the fit declared. Only column0, the value at the row’s own dose, is read.- absolute_score_weights
ndarrayorNone Fitted
abs(w_i * H_ij)columns, in component order.Nonerecords an omission.- equations
tupleofstr Fitted score-equation names, in component order.
- n_repeats
int Number of stored cross-fitting draws. The retained weights and the fold means describe draw 1.
- folds
FoldsorNone The partition the mechanism was cross-fitted over, which sets the rows of each
PolicySupport.fold_mean_ratioentry.Nonereads every row as one fold.- declared_support
tupleofndarrayorNone (lower, upper), the declared support on every row, fromdeclared_support_bounds().Nonewhen the fit declared none.
- policies
- Returns:
dictofstrtoPolicySupportOne record per policy, keyed by its report label.