Skip to content

scientific(selection): freeze training prevalence transform for held-out evaluation #681

Open

Description

@seonghobae

Finding

#680 requires leakage-safe rolling-origin candidate-K validation with a separately measured held-out/predictive diagnostic. The current topic_measurement::ReferenceTopicInput cannot yet project a later evaluation horizon onto the training prevalence coordinate system without leakage.

ReferenceTopicInput::new(...) calls build_design(...), and build_design(...) calls standardize_event_time(event_times). standardize_event_time computes its origin/mean/deviation from the event times supplied to that particular input. Those transformation parameters are not retained in ReferenceTopicInput or ReferenceTopicFit as an owner-issued prevalence-design basis.

A rolling-origin evaluator therefore has two unsafe choices today:

  1. construct a separate evaluation ReferenceTopicInput, which standardizes EventTime using evaluation-horizon statistics before applying training prevalence coefficients; or
  2. construct one combined input so train/evaluation rows share a transform, which makes the training design depend on future evaluation evidence.

Either choice violates the intended knowledge-cutoff boundary. The issue is not that future EventTime is intrinsically invalid (#671/#672); the issue is that the feature transform used by the fitted prevalence coefficients must be learned from the training state and reused unchanged for evaluation.

This also affects categorical prevalence features. build_design derives the ordered membership feature basis from memberships active in the input. A separately constructed evaluation input can therefore have a different feature basis/order from the training fit even when dimensions happen to be compatible.

Required causal RED / repair

Add an owner-issued, immutable prevalence-design basis retained by the admitted training input/fit and used for evaluation projection:

  • retain the training EventTime standardization origin/location/scale required to reproduce training design rows exactly;
  • retain the ordered PrevalenceFeature basis used by the fitted coefficient matrix;
  • project evaluation rows onto that frozen basis without recomputing location/scale from evaluation-horizon rows;
  • fail closed when an evaluation covariate/membership feature cannot be represented by the training basis rather than silently reordering/dropping it;
  • prove A/B fixtures where the same evaluation observation is scored in two evaluation batches with different surrounding future observations: its projected design row must be identical because only the frozen training basis may control the transform;
  • preserve owner-authenticated future EventTime that was already available by the relevant cutoff; do not reject it merely for being after the cutoff;
  • do not copy Evidence receipts, Membership authority, or scientific(time): bind admitted document event times to cutoff-qualified source evidence #671 source/event-time authentication into this numerical basis.

After this prerequisite exists, #680 can add fixed-global-parameter held-out/document-completion scoring and rolling-origin recovery evidence without test-horizon preprocessing leakage.

Scientific boundary

This basis is numerical/prevalence coordinate authority only. It is not source provenance, relation promotion, Membership provenance, topic identity, or release activation authority.

Roberts, M. E., Stewart, B. M., & Tingley, D. (2019). stm: An R Package for Structural Topic Models. Journal of Statistical Software, 91(2), 1–40. https://doi.org/10.18637/jss.v091.i02

Refs #638 #639 #671 #672 #680.

Activity

  1. seonghobae commented on Sep 22, 2026

    @seonghobae
    ContributorAuthor

    #681 source repair is now ordinary-forward on PR #639.

    Lineage:

    • initial API RED 057888a51812de65a68eaee02a98b42529099040;
    • owner-bound RED refinement 3adcfc2c8f3ed289c9bed4289f9c91db5a727f58, requiring ReferenceTopicTrainingInput rather than a detachable basis accessor;
    • production basis/aggregate ed8bdb1933226610c2d63fc2a30732dde72b16c8;
    • public export 93ddc4f8041e3c06ae6717c6a214f690ecd717d2;
    • owner-minimal projection hardening 2b1736f5228080eea7e3e562697409477e482b88;
    • public-doc restoration 1235d110c1030e8505273fc313d276a7294693e8;
    • A/B + fail-closed edge coverage 78eb5b418da11330d17a381da47c29315ceadeb4;
    • CHANGELOG 0ef1e7a0f71426b9352130f5f383cf12bfcf5996;
    • ADR 0012 currentization 09ed71ae95850148321d85e0307e91e1e806869c.

    The owner-issued PrevalenceDesignBasis retains the training EventTime origin/location/scale and exact ordered PrevalenceFeature basis. Evaluation projection never recomputes batch location/scale. The same focal day-5 observation is asserted identical when evaluated beside day 6 versus day 20; day 20 remains admissible at this numerical layer, so EventTime is not conflated with KnowledgeCutoff. Missing/extra covariate coordinates, missing active Membership, and unseen Membership role/group coordinates fail closed.

    Boundary: this is numerical/prevalence coordinate authority only. It does not authenticate Evidence, Membership provenance, relation activation, or source/event-time truth. #680 still owns actual fixed-training-state held-out/document-completion scoring and rolling-origin recovery. Keep #681 open until exact-head hosted evidence settles and the containing PR lands normally.

  2. seonghobae commented on Sep 22, 2026

    @seonghobae
    ContributorAuthor

    Follow-up hardening after ADR currentization: a76fefd11b0aaee49f5b3109c2daca7888602f97 now also projects the original day-1/day-3 training rows through the frozen basis and asserts the exact [-1, +1] EventTime coordinates, plus an explicit wrong-row-count covariate rejection. Current exact-head workflows were freshly recreated on this head and remain queued at runner admission; no hosted GREEN is claimed.

  3. seonghobae commented on Sep 22, 2026

    @seonghobae
    ContributorAuthor

    #683 is the fit-binding follow-up to this source repair. ReferenceTopicTrainingInput already owns the frozen training transform/basis; ReferenceTopicTrainingFit now ensures a downstream held-out evaluator cannot pair that basis with a dimension-compatible ReferenceTopicFit from a different training state while retaining owner authority.

    Current lineage on #639: 1c1b85aa... RED → d650c1dc... production aggregate → eaf205e7... export → ec13e76c... CHANGELOG/current head. This does not broaden #681 into Evidence/Membership/relation provenance or actual held-out scoring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions