Implement Ensemble-Based Multi-Track Finder - #26
Draft
dhshin04 wants to merge 2 commits into
Draft
Conversation
Five-component ensemble framework for finding multiple dimuon pairs per event, replacing the dynamic-occupancy MultiTrackFinder: - data/multi_track/gen_fixed_pairs.py: fork of gen_training_random.py that pins current_pairs=N (fixed) with random extra single-muon noise within the remaining budget; HitArray sized to exactly (N,62) - models/losses.py: add min_perm_loss(n_pairs) — permutation-invariant loss that brute-forces N! assignments (N<=3) to find minimum-cost pair slot matching; reproduces custom_loss exactly at N=1 - models/data_loader.py: add load_data_counter() returning (X, counts) for training the track counter classifier - models/MultiTrackFinder.py: unified N code path (no N=1 special case); output always (B,N,2,62,201); uses min_perm_loss; CLI --n_pairs replaces --max_pairs/--lambda_presence/--pos_weight_presence - models/TrackCounter.py: new classification model predicting number of dimuon pairs (0..max_pairs) using denoiser U-Net++ backbone + GlobalAveragePooling2D + Dense head with curriculum learning - eval_multi_track.py: rewrite with brute-force permutation matching before metrics, per-pair reporting, no chi-squared; --n_pairs arg - scripts/preprocess_fixed.slurm: generates fixed-N and random data - scripts/train_counter.slurm: trains TrackCounter (single A100) - scripts/train_finder.slurm: trains MultiTrackFinder for given N (4xA100), parameterized via N_PAIRS env var, runs eval after training
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.
Summary
Implements a fixed-N ensemble approach to multi-track dimuon pair finding, decomposing the problem into two independently trainable components:
models/TrackCounter.py): classifies how many ground-truth pairs (0..N) are in each event, using the denoiser U-Net++ backbone with a GlobalAveragePooling → Dense head and sparse-CE lossmodels/MultiTrackFinder.py): unified code path for all N (1–3); output always(B, N, 2, 62, 201); trained with the newmin_perm_loss— a brute-force permutation-invariant loss (N! ≤ 6) that finds the minimum-cost assignment of predicted pair slots to ground-truth slotsKey changes
data/multi_track/gen_fixed_pairs.pygen_training_random.py)models/losses.pymin_perm_loss(n_pairs)— permutation-invariant loss; exact match tocustom_lossat N=1models/data_loader.pyload_data_counter()— returns(X, counts)for counter trainingmodels/MultiTrackFinder.py--n_pairsreplaces--max_pairs/ presence loss argsmodels/TrackCounter.pyeval_multi_track.py--n_pairsargscripts/preprocess_fixed.slurmscripts/train_counter.slurmscripts/train_finder.slurmN_PAIRSenv var)Design decisions
min_perm_loss(1)is mathematically identical to the originalcustom_loss(same CE + overlap penalty scalar), so N=1 can be retrained through the new code without regressionsTest plan
gen_fixed_pairs.pyon a small sample; verifyHitArray_muphas lengthN*62andnPairs == Nevery eventmin_perm_loss(1)value matchescustom_losson identical input (after squeezing the N=1 pair axis)MultiTrackFinder.py --n_pairs 1and--n_pairs 2for 1 epoch; confirm output shapes(B,1,2,62,201)and(B,2,2,62,201)TrackCounter.pyfor 1 epoch; confirm confusion matrix prints at endeval_multi_track.py --n_pairs 2on a checkpoint; confirm per-pair tables print and no chi-squared appearstrain_finder.slurmwithN_PAIRS=1,N_PAIRS=2,N_PAIRS=3on HPC