Skip to main content

Module row_metric

Module row_metric 

Source
Expand description

RowMetric — the single provenance-carrying per-row inner product shared by the SAE-manifold likelihood (residual whitening) and the gauge (isometry pullback weight).

§Why this exists

The SAE-manifold machine historically carried two independent inner products:

  • the likelihood measured reconstruction residuals isotropically — a single scalar dispersion φ̂ = RSS / residual-dof, the data-fit loop summing the bare ½ rᵀr; there was no per-row metric at all; and
  • the gauge carried its own per-row metric in IsometryPenalty.weight: WeightField — a low-rank W_n = U_n U_nᵀ pullback g_n = J_nᵀ W_n J_n, settable independently of anything the likelihood saw.

Nothing structurally forced “the metric the likelihood whitens by” to equal “the metric the gauge pulls back through”. That is exactly the objective↔gradient-desync bug class wearing geometry clothing: a likelihood-metric ≠ gauge-metric state was representable.

RowMetric collapses the two into one object. The likelihood whitens through it; the gauge WeightField is constructed from it. A divergent-metric state is therefore unrepresentable — there is only one per-row factor stack U_n, with one MetricProvenance tag.

§Magic-by-default selector

There is no flag. The provenance is chosen by whether per-row Fisher factors exist:

  • no factors supplied ⇒ MetricProvenance::Euclidean; W_n = I_p; whitening is the identity, so φ̂ and the data-fit loop are bit-for-bit the prior isotropic path; and
  • per-row Fisher factors supplied ⇒ MetricProvenance::OutputFisher; the residual is whitened by U_nᵀ and the gauge pulls back through the same U_n.

§Validation

Every metric block is constructed through crate::normalize_fisher_rao_blocks, which broadcasts and eigenvalue-validates PSD-ness. RowMetric does not reimplement that validation; it materializes W_n = U_n U_nᵀ (which is PSD by construction) and runs it through the shared normalizer as the single point of truth for “is this a valid precision metric”.

Any rank floor used to make a block invertible for an internal solve is solver-only (mirroring RidgePolicy::solver_only, #747): it never enters the residual the objective sums, so δ cannot bias the criterion.

Structs§

RowMetric
The single per-row metric object. Holds one low-rank factor stack U_n (or none, for Euclidean) plus the validated PSD blocks, tagged with its MetricProvenance.

Enums§

MetricProvenance
Where the per-row metric came from — the provenance that makes “likelihood-metric ≠ gauge-metric” diagnosable instead of silent.
WeightField
Per-observation behavioral-metric field W_n ∈ ℝ^{p × p}, stored in low-rank factored form W_n = U_n U_n^T with U_n ∈ ℝ^{p × r_n}.