Add fast trap_burden mode with lightweight bulk/original-basis computation#371
Open
charlesmartin14 wants to merge 3 commits intomasterfrom
Open
Add fast trap_burden mode with lightweight bulk/original-basis computation#371charlesmartin14 wants to merge 3 commits intomasterfrom
trap_burden mode with lightweight bulk/original-basis computation#371charlesmartin14 wants to merge 3 commits intomasterfrom
Conversation
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.
Motivation
Description
trap_burden_modeargument (default"full") and flagscompute_original_basis,compute_full_bulk_reference,bulk_mode_sample, andcompute_original_trap_svdtoanalyze_trapsinterfaces in bothweightwatcher.analyze_trapsandtrap_analysis.analyze_trapsand wired defaults so"fast"disables expensive work.remove_traps.identify_trap_mode_indicesto accept optionalsvalsto avoid recomputing the SVD when available.compute_fast_bulk_trap_reference_metricswhich computes bulk-mode statistics from precomputedU,S,Vh(with optional sampling) to replace full bulk reconstruction in fast mode.apply_analyze_trapsto optionally skipcompute_original_basis_for_traps, precompute the permuted SVD once, callidentify_trap_mode_indiceswithsvals, and conditionally call the fast or full bulk metric functions.analyze_single_trapto accept aprecomputed_svdand acompute_original_trap_svdtoggle so the method can avoid extra SVDs and fall back to permuted-mode-derived metrics when the original basis is not computed.ov_*fields and several new output columns were added:B_absDelta_ipr_ovlamvar,B_absDelta_logtop5_ovlamvar,B_evalsq_logtop5_ovrank, andB_old_pr359_paper.tests/test_analyze_traps.pyto assert that fast mode skips the original-basis and full bulk-reference computations and thatfullmode still provides full diagnostics.Testing
pytest tests/test_analyze_traps.pyincluding the new teststest_analyze_traps_fast_mode_skips_original_basis,test_analyze_traps_fast_mode_skips_full_bulk_reference, andtest_analyze_traps_full_mode_allows_full_diagnosticsand the suite completed successfully.tests/test_analyze_traps.pywere executed and passed.Codex Task