Skip to content

[Stack 14/17] Fix D7: match Clojure repness metric formula (product of 4 signed values)#2521

Open
jucor wants to merge 1 commit intospr/edge/23c03d70from
spr/edge/80eaa87c
Open

[Stack 14/17] Fix D7: match Clojure repness metric formula (product of 4 signed values)#2521
jucor wants to merge 1 commit intospr/edge/23c03d70from
spr/edge/80eaa87c

Conversation

@jucor
Copy link
Copy Markdown
Collaborator

@jucor jucor commented Mar 30, 2026

Summary

Changes the representativeness metric from a weighted sum of absolutes to the
Clojure product formula (repness.clj:188-190).

Before (Python):

  • agree_metric = pa * (|pat| + |rat|) — weighted sum, tolerant of weak factors
  • disagree_metric = (1 - pd) * (|pdt| + |rdt|) — doubly wrong: uses (1-pd) and sum

After (Clojure formula):

  • agree_metric = ra * rat * pa * pat — product of 4 signed values
  • disagree_metric = rd * rdt * pd * pdt — product of 4 signed values

The product formula is more conservative: any factor near zero kills the entire
metric, requiring ALL dimensions (probability, significance, relative
representativeness) to be strong simultaneously.

The old disagree formula was doubly wrong:

  1. Used (1 - pd) instead of pd — high metric when disagree probability is LOW
  2. Used a weighted sum of absolutes instead of a signed product

No feature flag for the old formula — it has no defensible behavior.

Test plan

  • 5 new D7 formula tests (agree product, disagree product, zero-kills-metric,
    sign preservation, multiple known values)
  • Updated unit tests in test_repness_unit.py and test_old_format_repness.py
  • Full test suite passes (excluding DynamoDB/MinIO tests)
  • Private dataset tests pass (--include-local)
  • Golden snapshots re-recorded for all 7 datasets

🤖 Generated with Claude Code

Squashed commits

  • Add PR description and update plan/journal for D7 fix

commit-id:80eaa87c


Stack:


⚠️ Part of a stack created by spr. Do not merge manually using the UI - doing so may have unexpected results.

@jucor jucor changed the title Fix D7: match Clojure repness metric formula (product of 4 signed values) [Stack 14/17] Fix D7: match Clojure repness metric formula (product of 4 signed values) Mar 30, 2026
@jucor jucor force-pushed the spr/edge/80eaa87c branch 2 times, most recently from cfd57d1 to 90838d7 Compare March 30, 2026 22:47
@jucor jucor force-pushed the spr/edge/23c03d70 branch from d92e3f2 to be320d5 Compare March 30, 2026 22:47
…ues)

## Summary


Changes the representativeness metric from a weighted sum of absolutes to the
Clojure product formula (repness.clj:188-190).

**Before (Python):**
- agree_metric = `pa * (|pat| + |rat|)` — weighted sum, tolerant of weak factors
- disagree_metric = `(1 - pd) * (|pdt| + |rdt|)` — doubly wrong: uses `(1-pd)` and sum

**After (Clojure formula):**
- agree_metric = `ra * rat * pa * pat` — product of 4 signed values
- disagree_metric = `rd * rdt * pd * pdt` — product of 4 signed values

The product formula is more conservative: any factor near zero kills the entire
metric, requiring ALL dimensions (probability, significance, relative
representativeness) to be strong simultaneously.

The old disagree formula was doubly wrong:
1. Used `(1 - pd)` instead of `pd` — high metric when disagree probability is LOW
2. Used a weighted sum of absolutes instead of a signed product

No feature flag for the old formula — it has no defensible behavior.

## Test plan
- [x] 5 new D7 formula tests (agree product, disagree product, zero-kills-metric,
      sign preservation, multiple known values)
- [x] Updated unit tests in test_repness_unit.py and test_old_format_repness.py
- [x] Full test suite passes (excluding DynamoDB/MinIO tests)
- [x] Private dataset tests pass (--include-local)
- [x] Golden snapshots re-recorded for all 7 datasets

🤖 Generated with [Claude Code](https://claude.com/claude-code)


## Squashed commits

- Add PR description and update plan/journal for D7 fix

commit-id:80eaa87c
@jucor jucor force-pushed the spr/edge/80eaa87c branch from 90838d7 to 1390ff7 Compare March 31, 2026 00:35
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