cleverly.interventions.PolicySupport#
- class cleverly.interventions.PolicySupport(name: str, policy: str, min_density: float | None, ratio_quantiles: dict[float, float], max_ratio: float, effective_sample_size: float, ess_ratio: float, moved_fraction: float, capped_fraction: float | None, unsupported: int | None, mean_ratio: float, fold_mean_ratio: tuple[float, ...], min_mechanism: float | None = None, score_load: _InterventionLoadRow | None = None, score_load_omission: str | None = None, outside_declared_support: int | None = None, atom_mass: dict[float, float] | None = None)[source]#
Overlap for one policy: how hard the density ratio is working, and where it fails.
- Parameters:
- name
str Report label of the policy.
- policy
str The policy this row describes, from
describe_policy().- min_density
floatorNone Smallest estimated density at an observed dose, the denominator of the density ratio evaluated at the observed dose. On a categorical treatment it is the smallest fitted probability of the observed level.
Noneon the classifier route, which fits no density.- ratio_quantiles
dictoffloattofloat Quantiles of the density ratio at the observed dose.
- max_ratio
float The largest such ratio: how much one row can move the estimate.
- effective_sample_size
float Kish effective sample size of those ratios.
- ess_ratio
float That size as a share of
n.- moved_fraction
float Share of rows the policy moves away from their own dose, averaged over a randomized policy’s components with their known weights.
- capped_fraction
floatorNone Share of rows a declared
capholds at their own dose, weighted the same way.Noneon a categorical treatment, where no cap is evaluated.- unsupported
intorNone Rows whose assigned dose falls where the estimated density is exactly zero. Estimated zeros flag model support failures, not proof of nonidentification.
Noneon the classifier route, which fits no density to read a zero from.- mean_ratio
float Mean density ratio at the observed dose over every row. The ratio is the density of the supported part of the shifted law relative to the observed law. Under the true density its expectation is
P(d(A, W) in the conditional support of g(. | W)), for capped and uncapped policies. It equals 1 when the policy preserves conditional support. An upper cap alone does not ensure this for negative shifts or support gaps.- fold_mean_ratio
tupleoffloat The same mean over the rows each cross-fitting fold holds out, in fold order. An in-sample fit has one fold, so the tuple holds
mean_ratioalone. A fold mean far from that reference value can signal density estimation error, but sampling variation also affects it. The standard error reads that ratio. The mean is of the ratio alone, before any mechanism divides it.- min_mechanism
floatorNone Smallest product of the further mechanisms that divide the covariate beside the ratio, or
Nonewhen the fit declared neither. When it is notNonethe quantiles and the effective sample size above are of the whole weight.- score_load
_InterventionLoadRoworNone Concentration of the exact absolute score weights retained for this policy’s equation, and the cross-fitting draw it describes.
Nonemeans the fitted artifact did not supply a usable column. The twelve keys areequation,n_total,n_targeted,effective,targeted_ratio,total_ratio,top_1pct,top_5pct,max_load,zero_load,reported_repeatandn_repeats.- score_load_omission
strorNone Machine-readable reason why
score_loadis unavailable.- outside_declared_support
intorNone Rows a component assigns a dose outside the declared support, counted over the policy’s components, on either route. The fit refuses a positive count before any learner, so a fitted result reads 0.
Nonewhen the fit declared no support.- atom_mass
dictoffloattofloatorNone The mean fitted probability \(P(A = a_k \mid W)\) of each declared atom, on the density route.
Nonewithout declared atoms, and on the classifier route, which fits no law of the dose.
- name