cleverly.validation.ScoreCheckRow#

class cleverly.validation.ScoreCheckRow(name: str, kind: str, score: float, threshold: float, std_error: float, passed: bool, converged: bool, n_iter: int, method: str, score_initial: float = nan, failure: str = '', hessian_condition: float = nan, folds_converged: tuple[int, int] | None = None, stopping: str = 'relative', residual_se: float = nan, coverage_bound: float = nan, rule_bound_se: float = nan)[source]#

The score diagnostic for one estimand or one targeted family.

score_initial and hessian_condition are nan on the rows that do not carry them, which is a sentinel and not an unknown – see sentinel_equality() for why comparing two of these rows needs saying so rather than inheriting the generated __eq__.

Parameters:
namestr

Estimand alias or targeted family.

kindstr

Which score equation this row checks.

scorefloat

The solved score, on the scale threshold is given in.

thresholdfloat

Magnitude the score may reach and still pass.

std_errorfloat

Standard error the threshold is expressed in, read through plugin_std_error. It is a scale for the tolerance. On a fit that supplies no inference it is the plug-in diagnostic and not a standard error, and ScoreCheck.to_frame() does not publish it.

passedbool

Whether the score stayed inside it.

convergedbool

Whether targeting reached its own tolerance.

n_iterint

Targeting iterations taken.

methodstr

Targeting algorithm used.

score_initialfloat

The score before targeting, for comparison.

failurestr

What went wrong, when something did.

hessian_conditionfloat

Condition number of the targeting Hessian. A large value says the solve was ill-conditioned even where the score came out small.

folds_convergedtuple of bool

Whether each fold’s own targeting converged, under fold-specific targeting.

stoppingstr

The stopping rule that judged the row. "relative" is the shipped bar, and any other value means threshold is the threshold the solver stopped at.

residual_sefloat

On a "diagnostic" row of a fit under a declared rule, |P_n IC| / se of the estimand. nan elsewhere.

coverage_boundfloat

The coverage a Wald interval keeps at that residual (wald_coverage_bound()).

rule_bound_sefloat

Under scaled_var, the residual the rule implies before the fit is read: sum_j |g_j| threshold_j / se, over the score columns the estimand is a combination of. It equals c for a unit-weight arm mean, and it has no a priori value for a contrast. On a stratified fit it sums the stratum blocks. nan for a doubly-robust fit, a fit with several draws, an incremental tilt, a working-model coefficient, and a shift, policy, regime or ratio row (_rule_bound_se gives each reason).

Methods#

Attributes#

ScoreCheckRow.coverage_bound: float = nan#
ScoreCheckRow.failure: str = ''#

Why the step stopped, when it did not converge. Empty when it did.

ScoreCheckRow.folds_converged: tuple[int, int] | None = None#

For a fold-targeted fit, how many of the per-fold solves converged.

ScoreCheckRow.hessian_condition: float = nan#

Conditioning of the last Newton Hessian. Large means epsilon is barely identified even where the score looks solved.

ScoreCheckRow.ratio#

Score relative to its threshold; below 1 passes.

ScoreCheckRow.reduction#

How far targeting moved the score, as a factor. Above 1 means it shrank.

ScoreCheckRow.residual_se: float = nan#

The three columns of the estimand rows of a fit under a declared rule. nan is a sentinel for “this row does not carry it”.

ScoreCheckRow.rule_bound_se: float = nan#
ScoreCheckRow.score_initial: float = nan#

The same score before the fluctuation moved anything. A step that starts near zero had nothing to do, which is a different situation from one that started large and was driven down – and only the latter is evidence targeting worked.

ScoreCheckRow.stopping: str = 'relative'#

The rule that judged this row. Beside threshold so a reader of a frame can tell a row held to the default bar from a row held to its fit’s declared rule.

ScoreCheckRow.name: str#
ScoreCheckRow.kind: str#
ScoreCheckRow.score: float#
ScoreCheckRow.threshold: float#
ScoreCheckRow.std_error: float#
ScoreCheckRow.passed: bool#
ScoreCheckRow.converged: bool#
ScoreCheckRow.n_iter: int#
ScoreCheckRow.method: str#