Repository navigation
scientific(selection): freeze training prevalence transform for held-out evaluation #681
Description
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:
- construct a separate evaluation
ReferenceTopicInput, which standardizesEventTimeusing evaluation-horizon statistics before applying training prevalence coefficients; or - 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
EventTimestandardization origin/location/scale required to reproduce training design rows exactly; - retain the ordered
PrevalenceFeaturebasis 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
EventTimethat 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
Activity
test(scientific): require frozen training prevalence basis (#681)
test(scientific): bind frozen prevalence basis to training aggregate (#…
feat(scientific): freeze training prevalence coordinates (#681)
feat(scientific): export frozen prevalence basis (#681)
fix(scientific): keep frozen prevalence projection owner-minimal (#681)
chore(topic): restore coordinate docs after basis export (#681)
test(scientific): harden frozen prevalence projection edges (#681)
docs(changelog): record frozen prevalence basis (#681)
docs(adr): freeze training prevalence coordinates for held-out use (#681
seonghobae commentedon Sep 22, 2026
#681 source repair is now ordinary-forward on PR #639.
Lineage:
057888a51812de65a68eaee02a98b42529099040;3adcfc2c8f3ed289c9bed4289f9c91db5a727f58, requiringReferenceTopicTrainingInputrather than a detachable basis accessor;ed8bdb1933226610c2d63fc2a30732dde72b16c8;93ddc4f8041e3c06ae6717c6a214f690ecd717d2;2b1736f5228080eea7e3e562697409477e482b88;1235d110c1030e8505273fc313d276a7294693e8;78eb5b418da11330d17a381da47c29315ceadeb4;0ef1e7a0f71426b9352130f5f383cf12bfcf5996;09ed71ae95850148321d85e0307e91e1e806869c.The owner-issued
PrevalenceDesignBasisretains the training EventTime origin/location/scale and exact orderedPrevalenceFeaturebasis. 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.
chore(topic): format frozen prevalence basis (#681)
chore(test): format frozen prevalence basis contract (#681)
chore(topic): preserve rustfmt newline after basis export (#681)
test(scientific): prove training transform reproduction and row guards (
seonghobae commentedon Sep 22, 2026
Follow-up hardening after ADR currentization:
a76fefd11b0aaee49f5b3109c2daca7888602f97now 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.seonghobae commentedon Sep 22, 2026
#683 is the fit-binding follow-up to this source repair.
ReferenceTopicTrainingInputalready owns the frozen training transform/basis;ReferenceTopicTrainingFitnow ensures a downstream held-out evaluator cannot pair that basis with a dimension-compatibleReferenceTopicFitfrom 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.