Skip to content

feat: negative-set robustness — Phase 2 benchmark honesty - #7

Closed
cschanhniem wants to merge 1 commit into
mainfrom
feat/negative-set-robustness
Closed

cschanhniem wants to merge 1 commit into
mainfrom
feat/negative-set-robustness

Conversation

@cschanhniem

Copy link
Copy Markdown
Collaborator

Summary

Implements Phase 2: Negative-set robustness from AGENTS.md:

"Performance remains meaningful across multiple negative datasets."

A pipeline that only outperforms trivial negatives (all-A, all-G) cannot be trusted. This PR verifies the pipeline still enriches AMP-like sequences against harder, more realistic negative classes.

New negative datasets

Dataset Description Key property
poly_cationic.csv Poly-K, poly-R, KR-alternating High charge, zero hydrophobic fraction
poly_hydrophobic.csv Poly-L, poly-I, poly-V Extreme hydrophobicity, zero charge

These represent one-dimensional negatives — sequences that have one AMP-like property but lack the balance that makes real AMPs work.

What the tests prove

Test Result
Poly-K: high charge, zero hydrophobicity ✅ Verified by feature assertion
Poly-L: extreme hydrophobicity, zero charge ✅ Verified
Safety scorer penalizes excess charge (poly-K) ✅ safety < 0.7
Safety scorer penalizes excess hydrophobicity (poly-L) ✅ safety < 0.5
EF > 1.0 vs degenerate negatives ✅
EF > 1.0 vs poly-cationic negatives ✅
EF > 1.0 vs poly-hydrophobic negatives ✅
recall@3 = 1.0 vs poly-cationic ✅
recall@3 = 1.0 vs poly-hydrophobic ✅
Mean positive ensemble > mean negative across all 3 negative types ✅

Test plan

  • make test — 53 tests pass
  • ruff check src tests — clean

…ves, 53 tests

Phase 2: Negative-set robustness — pipeline must enrich AMP-like sequences
above negatives regardless of negative type, not just against easy all-repeat controls.

- Add examples/negative/poly_cationic.csv: 5 poly-K/R sequences with high charge
  density but no hydrophobic face (a harder negative set than degenerate repeats)
- Add examples/negative/poly_hydrophobic.csv: 5 poly-L/I/V sequences with high
  hydrophobic fraction but zero charge (another harder negative class)
- Add examples/benchmark/robustness_positives.csv: 3 canonical AMP-like positives
  used across all robustness tests
- Add test_negative_robustness.py: 16 tests verifying:
  - Poly-cationic sequences have correct physicochemical properties (high charge, zero hydro)
  - Poly-hydrophobic sequences have correct properties (high hydro, zero charge)
  - Safety scorer penalizes both classes (excess charge / excess hydrophobicity)
  - EF > 1.0 vs degenerate, poly-cationic, AND poly-hydrophobic negatives
  - recall@3 = 1.0 (all 3 positives in top-3) vs both hard negative sets
  - Mean positive ensemble score > mean negative ensemble across all negative types
- Add recall_at_k, random_recall_at_k, enrichment_factor, benchmark_summary to evaluate.py
- Fix ruff F401 unused imports in pipeline.py, test_cli.py, test_pipeline_filters.py
- 53 tests passing, ruff clean
@cschanhniem

Copy link
Copy Markdown
Collaborator Author

Superseded by PR #11 (feat/integrate-all-phases), which merges all Phase 2 + Phase 3 work into a single consolidation PR with 251 tests passing.

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