Skip to content

Feature reset#6

Open
Suadeo03 wants to merge 19 commits into
physionetchallenges:mainfrom
Suadeo03:feature-reset
Open

Feature reset#6
Suadeo03 wants to merge 19 commits into
physionetchallenges:mainfrom
Suadeo03:feature-reset

Conversation

@Suadeo03

Copy link
Copy Markdown

No description provided.

Suadeo03 and others added 19 commits June 30, 2026 15:16
- Add .gitignore and .dockerignore for Python/ML project
- Add CLAUDE.md with project context, constraints, and feature map
- Add build_dev_subset.py for stratified dev data sampling
- Swap RandomForest → XGBoost in team_code.py and requirements.txt

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both files contain local dev context that should not be in the
shared repo. Added to .gitignore so they won't be re-staged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…gn, tighter regularization (48 features, LOSO 0.540)
…C 0.5399 unchanged); reorganize EDA scripts)
- Add AgeResidualizer pipeline step (features/age_residuals.py): appends
  CA_rate_age_residual and EEG_var_REM_Wake_age_residual (feature count 48→50)
- Extract build_pipeline() to features/pipeline.py — shared by team_code.py
  and loso_cv.py, closing the divergence bug where LOSO validated a stale
  48-feature model while train_model had already moved to 50
- Add ratchet check system (ratchet_check.py, ratchet_baselines.json) and
  wire into check_submission_files.py for pre-submission regression gating
- Add reg_sweep.py for regularization coefficient sweeps

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- git mv check_submission_files.py, ratchet_check.py, ratchet_baselines.json,
  reg_sweep.py into tools/; plain mv for untracked loso_cv.py and
  confusion_at_threshold.py
- Fix sys.path.insert in loso_cv.py and reg_sweep.py to walk up two levels
  (tools/../ = repo root) so from features/... and from helper_code/... resolve
- Add _DEFAULT_BASELINES_PATH in ratchet_check.py (script-relative, not
  CWD-relative) and use it as default for load_baselines(), check_ratchet(),
  and --baselines-file argparse arg
- Same script-relative fix for check_submission_files.py --baselines-file
- Anchor /loso_cv.py in .gitignore so tools/loso_cv.py is now tracked

All five verification commands (check_submission_files, loso_cv --help,
reg_sweep --help, ratchet_check standalone, check_submission_files + ratchet)
pass from repo root.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The reconciled loso_cv.py had sys.path.insert at line 35 (before imports),
not line 63 where the earlier edit landed. Patch now inserts the correct
one-level-up dirname so helper_code and features/ resolve from repo root
when the script is invoked from inside tools/.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
features/caisr_enriched.py:
- Add extract_markov_transition_features() / N_MARKOV_FEATURES=9 (NF1):
  transition_entropy, n3_to_wake_rate, rem_to_n3_rate, escalating_rate,
  + 5-state stationary distribution (Wake/N1/N2/N3/REM). Gated on
  _MIN_TRANSITIONS=40 (estimability of transition matrix, not duration —
  see module-level "Gating design decision" comment for why duration was
  rejected as the gate). NOT wired into extract_caisr_enriched_features.
- Add extract_arousal_clustering_features() / N_AROUSAL_CLUSTERING_FEATURES=2
  (NF2): cv_inter_arousal_interval + burst_index. Gated on
  _MIN_AROUSAL_EVENTS=5. NOT wired in.
- Document the _MIN_RECORDING_HOURS gating-design decision: confirmed the
  duration guard described in 2026-07-12 learning_log.md was never
  implemented (not a lost commit); resolved here by gating on estimability
  directly rather than reviving a blanket duration cutoff.

tools/test_combined_features.py:
- New standalone ablation script: tests NF1+NF2 as a single 11-feature
  block against the shipped 48-feature baseline (NOT one-at-a-time).
  Collinearity check runs and prints BEFORE the ablation. Supports
  --rotate-i0002, --C, consistent with loso_cv.py/reg_sweep.py conventions.
- Fix: corrected _IDX_WAKE/N1/N2/N3/REM_PCT index constants (were off by 1
  — FEATURES.md comment incorrectly said caisr_base[2]=Wake%, but
  caisr_base[2]=Limb_idx; Wake% starts at caisr_base[3]). Verified against
  caisr_base.py's actual return array. _IDX_AROUSAL_IDX and
  _IDX_SPONT_AROUSAL were correct and unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
FeatureDropper (features/feature_selection.py) inserted into pipeline after
AgeResidualizer; removes 11 features whose coefficients changed sign across
LOSO folds — measured evidence of site-specific overfitting. LOSO result:
+8.2% relative reward, AUROC 0.6459→0.6711, all three folds improved, cross-
fold spread shrank 0.1264→0.1145. Threshold re-tuned 0.08→0.10 for new
probability distribution. features/subtype_weighting.py (Entry 7 MCI
weighting, validated separately) added to repo but not wired into this entry.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Entry 8: drop sign-flipping features (Stage 1), threshold 0.10
@Suadeo03

Copy link
Copy Markdown
Author

Merged feature add updates

@Suadeo03 Suadeo03 closed this Jul 22, 2026
@Suadeo03 Suadeo03 reopened this Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant