Add optional trap variance-burden metrics to analyze_traps (trap_burden, variants)#362
Open
charlesmartin14 wants to merge 1 commit intomasterfrom
Open
Add optional trap variance-burden metrics to analyze_traps (trap_burden, variants)#362charlesmartin14 wants to merge 1 commit intomasterfrom
charlesmartin14 wants to merge 1 commit 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
analyze_trapsbehavior.Description
analyze_traps:trap_burden(defaultFalse) andtrap_burden_variant(default"top5"), and passed them through intoparamsso default runs are unchanged.compute_bulk_trap_reference_metricsto compute bulk-mode baselines (bulk_top_5_mass_mean,bulk_top_5_mass_std,bulk_ipr_mean,bulk_ipr_std) by unpermuting bulk rank-1 modes and computing top-mass and IPR per mode.analyze_single_trapto (whentrap_burden=True) computeeval_perm,spectral_excess_abs,spectral_excess_rel,trap_ipr,ipr_lift,ipr_lift_excess_pos,top_5_lift,top_5_lift_excess_pos,log1p_top_5_lift, overlap diagnostics (ov_lam_weighted_mean,ov_lam_weighted_var,ov_rank_mean,ov_rank_std,ov_hhi,ov_participation,ov_entropy,ov_max), and burden aggregates (trap_variance_burden_ipr,trap_variance_burden_top5, and canonicaltrap_variance_burdenselected bytrap_burden_variant)._top_mass_fraction(computes fraction of absolute mass in top 5% entries) and_compute_overlap_metrics(computes overlap distribution p_a fromX = W_true.T @ W_trueand returns weighted means/vars/rank stats and diagnostics)._trap_result_columns(no renames or reordering of existing columns).Trap variance burdendescribing both IPR and Top5 burden formulas and interpretation.Testing
tests/test_analyze_traps.pythat verify backward compatibility when callinganalyze_traps(..., trap_burden=False), presence of new columns whentrap_burden=True, finite-valued diagnostics when traps exist, correcttrap_variance_burdenselection fortrap_burden_variant="ipr"and"top5", and that invalidtrap_burden_variantraisesValueError.pytest -q tests/test_analyze_traps.pyin this environment and the suite completed successfully with tests skipped due to missing Torch runtime (16 skipped).Codex Task