Skip to content

Recovery scores

When the governing equation is known, a run is judged on three axes at once: the term set, the coefficients, and the fit. judge_recovery returns that verdict; term_set_jaccard and load_bearing_recall give partial credit beside the binary answer. Success rates over seeds are reported with a Wilson interval and compared pairwise with an exact test, so a rate on this site or in a report always carries its uncertainty.

Name Summary
kd.judge_recovery(rhs, u_t[, ...]) Judge one reconstructed RHS against a known truth law, numerically.
kd.RecoveryVerdict(structure_ok, coefficients_ok[, ...]) Three-axis aggregate recovery judgment (charter §5.4-3, projection form).
kd.span_floor(u_t, truth_columns) Oracle B: the best NMSE reachable inside the truth span, plus its fit.
kd.term_set_jaccard(actual, truth) Jaccard similarity of two term-label sets:
kd.load_bearing_recall(verdict, nmse_threshold) Share of truth terms the reconstruction individually depends on.
kd.wilson_interval(successes, trials[, ...]) Wilson score interval for a binomial proportion.
kd.rate_summary(successes, trials[, ...]) successes / trials with its Wilson interval, as one record.
kd.RateSummary(successes, trials[, ...]) One benchmark cell's rate, ready for a report row.
kd.paired_exact_test(only_a, only_b) Two-sided exact McNemar p-value on the discordant pairs.

judge_recovery

judge_recovery(
    rhs: Tensor,
    u_t: Tensor,
    *,
    truth_columns: dict[str, Tensor],
    truth_coefficients: dict[str, float],
    coeff_rtol: float,
    nmse_threshold: float,
) -> RecoveryVerdict

Judge one reconstructed RHS against a known truth law, numerically.

RecoveryVerdict dataclass

Three-axis aggregate recovery judgment (charter §5.4-3, projection form).

overall property

overall: bool

All three axes hold.

span_floor

span_floor(
    u_t: Tensor, *, truth_columns: dict[str, Tensor]
) -> tuple[float, dict[str, float]]

Oracle B: the best NMSE reachable inside the truth span, plus its fit.

term_set_jaccard

term_set_jaccard(
    actual: Iterable[str], truth: Iterable[str]
) -> float

Jaccard similarity of two term-label sets: |A ∩ T| / |A ∪ T|.

load_bearing_recall

load_bearing_recall(
    verdict: RecoveryVerdict, *, nmse_threshold: float
) -> float

Share of truth terms the reconstruction individually depends on.

wilson_interval

wilson_interval(
    successes: int, trials: int, *, confidence: float = 0.95
) -> tuple[float, float]

Wilson score interval for a binomial proportion.

rate_summary

rate_summary(
    successes: int, trials: int, *, confidence: float = 0.95
) -> RateSummary

successes / trials with its Wilson interval, as one record.

RateSummary dataclass

One benchmark cell's rate, ready for a report row.

to_dict

to_dict() -> dict[str, Any]

JSON-safe projection.

paired_exact_test

paired_exact_test(only_a: int, only_b: int) -> float

Two-sided exact McNemar p-value on the discordant pairs.