Answer architecture round 1: delete question-bench, keep its run's results in item 77 citing the commit that held it, and correct item 85's mention of item 78

This commit is contained in:
2026-10-09 00:46:44 +02:00
parent a9ec529158
commit 0050cd6772
11 changed files with 7 additions and 507 deletions
+4 -4
View File
@@ -1,4 +1,4 @@
from typing import Callable, Sequence
from typing import Callable
import collections
import dataclasses
import statistics
@@ -62,16 +62,16 @@ def bench(units: list[Unit], places: list[Place], unresolved: int, spread: dict[
return RunScores(len(units), len(named), unmeasured, scores)
def auc(named: Sequence[float], rest: Sequence[float]) -> float:
def auc(named: list[int], rest: list[int]) -> float:
"""The chance a named unit outranks one not named, a tie counting half: 0.5 is a coin toss, 1.0 a perfect ranking."""
wins = sum((a > b) + 0.5 * (a == b) for a in named for b in rest)
return wins / (len(named) * len(rest))
def top_k(named: Sequence[float], rest: Sequence[float]) -> float:
def top_k(named: list[int], rest: list[int]) -> float:
"""The share of the metric's k highest units the seats named, k being how many they named. Units tied at the cut share its remaining slots evenly, as a random order of them would."""
k = len(named)
cut = sorted([*named, *rest], reverse=True)[k - 1]
cut = sorted(named + rest, reverse=True)[k - 1]
above = sum(value > cut for value in named)
slots = k - above - sum(value > cut for value in rest)
tied_named = sum(value == cut for value in named)