fix: flux defaults to KL per eq 7; unify four drifted defaults - #47
Merged
Conversation
flux: distance_metric now defaults to 'kl'. METRICS eq 7 defines phenotypic flux AS the KL divergence; l1/jsd stay available as extensions. This CHANGES reported flux numbers for callers relying on the default. Retires OPEN_QUESTIONS['flux_distance_default']. defaults: four knobs were declared in two layers with different values. The outer declaration silently wins, so the inner one is dead code that only bites someone constructing TCRIModule or UnifiedTrainingPlan directly. Unified each to the value that was already effective, so no fitted result changes: global_scale TCRIModel 5.0 vs TCRIModule 10.0 -> 5.0 local_scale TCRIModel 3.0 vs TCRIModule 5.0 -> 3.0 n_steps_kl_warmup train() 2000 vs UnifiedTrainingPlan 1000 -> 2000 (reconstruction_loss_scale was the same defect, unified earlier in 19db68e) global_scale was found by the new test on its first run, having been missed by every manual pass including today's. tests/test_shared_defaults.py guards the class rather than the instances: it compares every shared default across the two construction seams. The knob test could not catch this -- it verifies a value ARRIVES at its target, which it does; the defect is that the two declared defaults differ. 177 passed, 3 skipped. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two small fixes and one new guard.
1.
phenotypic_fluxdefaults to KLMETRICS eq 7 defines phenotypic flux as the KL divergence. The code defaulted to
l1. Nowdistance_metric="kl";l1andjsdremain available as extensions.kernels already existed in
tcri/_distance.py— only the default moved. RetiresOPEN_QUESTIONS['flux_distance_default'].2. Four defaults declared twice, with different values
A knob declared in both layers means the outer declaration silently wins and the inner
one is dead — reachable only by constructing
TCRIModuleorUnifiedTrainingPlandirectly, which is exactly what a fixture or downstream user does.
global_scale(α)TCRIModel5.0TCRIModule10.0local_scale(β)TCRIModel3.0TCRIModule5.0n_steps_kl_warmuptrain()2000UnifiedTrainingPlan1000reconstruction_loss_scale19db68eEach is unified to the value that was already effective, so no fitted result
changes. This is not a choice about the right hyperparameter — it removes a value that
silently does nothing.
3.
tests/test_shared_defaults.py— guards the class, not the instancesCompares every shared default across the two construction seams
(
TCRIModel.__init__→TCRIModule.__init__,TCRIModel.train→UnifiedTrainingPlan), plus a regression lock on the four known ones.global_scalewas found by this test on its first run, having been missed by everymanual pass including the one earlier today that turned up the other three.
The existing knob test could not catch this: it verifies a value arrives at its target,
which it does. The defect is that the two declared defaults differ, so anyone reading
one signature is misled about what the package does. Signature-only — no model is
constructed, runs in ~3 s.
Tests
177 passed, 3 skipped.🤖 Generated with Claude Code