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:
namestr

Report label of the policy.

policystr

The policy this row describes, from describe_policy().

min_densityfloat or None

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. None on the classifier route, which fits no density.

ratio_quantilesdict of float to float

Quantiles of the density ratio at the observed dose.

max_ratiofloat

The largest such ratio: how much one row can move the estimate.

effective_sample_sizefloat

Kish effective sample size of those ratios.

ess_ratiofloat

That size as a share of n.

moved_fractionfloat

Share of rows the policy moves away from their own dose, averaged over a randomized policy’s components with their known weights.

capped_fractionfloat or None

Share of rows a declared cap holds at their own dose, weighted the same way. None on a categorical treatment, where no cap is evaluated.

unsupportedint or None

Rows whose assigned dose falls where the estimated density is exactly zero. Estimated zeros flag model support failures, not proof of nonidentification. None on the classifier route, which fits no density to read a zero from.

mean_ratiofloat

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_ratiotuple of float

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_ratio alone. 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_mechanismfloat or None

Smallest product of the further mechanisms that divide the covariate beside the ratio, or None when the fit declared neither. When it is not None the quantiles and the effective sample size above are of the whole weight.

score_load_InterventionLoadRow or None

Concentration of the exact absolute score weights retained for this policy’s equation, and the cross-fitting draw it describes. None means the fitted artifact did not supply a usable column. The twelve keys are equation, n_total, n_targeted, effective, targeted_ratio, total_ratio, top_1pct, top_5pct, max_load, zero_load, reported_repeat and n_repeats.

score_load_omissionstr or None

Machine-readable reason why score_load is unavailable.

outside_declared_supportint or None

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. None when the fit declared no support.

atom_massdict of float to float or None

The mean fitted probability \(P(A = a_k \mid W)\) of each declared atom, on the density route. None without declared atoms, and on the classifier route, which fits no law of the dose.

Methods#

PolicySupport.summary() → str[source]#

Return a printable summary.

Returns:
str

A printable table, one line per row of the report.

Attributes#

PolicySupport.atom_mass: dict[float, float] | None = None#
PolicySupport.min_mechanism: float | None = None#

Smallest \(\pi(A, W)\,q_z(A, W)\) among the mechanisms that divide the covariate alongside the ratio, or None when the fit declared neither. The quantiles and ESS above are of the whole weight when this is not None.

PolicySupport.outside_declared_support: int | None = None#
PolicySupport.score_load: _InterventionLoadRow | None = None#
PolicySupport.score_load_omission: str | None = None#
PolicySupport.name: str#
PolicySupport.policy: str#
PolicySupport.min_density: float | None#
PolicySupport.ratio_quantiles: dict[float, float]#
PolicySupport.max_ratio: float#
PolicySupport.effective_sample_size: float#
PolicySupport.ess_ratio: float#
PolicySupport.moved_fraction: float#
PolicySupport.capped_fraction: float | None#
PolicySupport.unsupported: int | None#
PolicySupport.mean_ratio: float#
PolicySupport.fold_mean_ratio: tuple[float, ...]#