Temporal straightening - #493
Draft
edyoshikun wants to merge 13 commits into
Draft
Conversation
Add an optional MMD-vs-HPI kinetics plot showing when and how much each condition's cell cloud diverges from control over infection time. - config: mmd_hpi_bin_hours (None = off) sets the HPI bin width in hours - _compute_hpi_mmd: per-bin MMD is TIME-MATCHED — control@bin vs condition@bin, not condition@bin vs the time-pooled control reference. The DynaCLR embedding carries a strong time/culture axis (uninfected cells drift substantially over a 36h timelapse), so a time-pooled reference conflates infection with that axis and produces a spurious early-high/dip artifact. Matching within the bin cancels the shared time component and isolates infection. - emits a control-vs-control null (half-split per bin) as the no-difference floor - plot_mmd_vs_hpi: condition curves + grey null band; hollow markers = per-bin MMD not significant (raw p > mmd_pvalue_threshold) Validated: pAL17 becomes a clean sigmoid (~0 until ~14h, rise to 0.25); TOMM20 shows a real monotonic rise (~0.004->0.018) above null, vindicating a genuine but weak infection signal that the time confound had previously distorted. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Weak channels (TOMM20/Phase3D) have a real but graded control-vs-perturbed shift, not a distinct bimodal split — the perturbed-only GMM gate abstains on them. Add a control-anchored alternative that produces labels with a controlled false-positive rate. - fit_control_anchored_labels (witness_gmm.py): model perturbed scores as pi*N(control) + (1-pi)*N(remodel) with the baseline Gaussian FROZEN to the (time-matched) control distribution; fit only the remodel component + mixing weight via constrained EM. "Remodel" = excess over baseline, so a subtle proportion shift still yields labels. Posterior threshold calibrated so the control false-positive rate equals control_fp_target. - config: gate (gmm | control_anchored) + control_fp_target (default 0.05) - label_marker branches on gate; sidecar records gate/remodel_fraction/control_fp/ posterior_threshold for control_anchored, GMM summary otherwise - control-FP diagnostic line uses the calibrated threshold; plot_witness_gmm is GMM-only Validated: TOMM20 (time-matched witness + control_anchored, 5% target) yields 6617 remodel / 9123 noremodel with realized control FP 0.050 (vs ~22% under the pooled GMM gate). Tests 6/6. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Curvature loss (1 - cos of consecutive latent velocities) and a shared next-state predictor MLP for temporal-dynamics learning, both acting on the encoder embedding z. Stop-grad predictor target; DDP-safe zero for all-invalid sequence batches. Includes unit tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add emit_sequence to the datamodule/dataset: sample K consecutive same-track same-marker frames (fixed frame stride) via the lineage lookup, emit a (B*K,C,Z,Y,X) 'sequence' batch key with a valid mask. Engine encodes it in one forward and adds lambda_curv*L_curv + lambda_pred*L_pred on z, with cosine-annealed weights. All defaults disabled so existing configs are unaffected. Includes a fast-dev smoke config. Also fix a pre-existing z_focus NaN guard in _slice_patch that only caught Python float NaN, not numpy float, crashing int(NaN) on parquets with unpopulated z_focus rows. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
edyoshikun
marked this pull request as draft
July 27, 2026 17:57
edyoshikun
pushed a commit
that referenced
this pull request
Aug 7, 2026
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.
No description provided.