research(rectification): blind-pick test — scorer cannot tell recorded birth time from random times
Recorded time + 4 random times (>=60 min away) on 77 public AA cases: the production event scorer picks the recorded time 23.1% (chance 20%, z=0.06); random times 'match' 87.2% of events vs 86.9% for the truth. Fake-event control at chance; positive control (years nudged +-3 to the true chart) 82.2%, so the harness detects signal when present. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXp17MSiRTd1f9VANYqb
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
e86351b2a2
commit
7091c51df2
@@ -132,3 +132,4 @@ Do not open new product surfaces before at least one of these four lanes is clos
|
||||
- 2026-09-30 盘型口径研究(BUG-1105):`<repo>/docs/research/rectification_varga_resolution_2026_09_30.md`——目标从分钟改为分盘上升段。v5 六题后 ±10 D9 / D10 头段 = 真值 88% / 86%,占比 ≥ 0.6 留一法 92% / 90%;±30 约 1/4–1/3 用户可给可信分盘;±60 分盘 blocked。按段选题 ≤ ±30 有 +3~+7 例;提前停不过红线;「不用校正」只对只需 D1 的问题成立。**建议立实现单**(§7)。
|
||||
- 2026-10-01 角度类时间技法研究(BUG-1141):`<repo>/docs/research/rectification_angle_timing_2026_10_01.md`——行运压上升 / 天顶、次限推运角、太阳弧(1° ≈ 4 分钟),77 例 v5 真实日期对乱序日期 9 项预登记检验 0 项显著(最高胜过 58%,门槛 99.44%);年龄结构保持对照同样无信号;`closed_by_design`。
|
||||
- 2026-10-05 纳迪秒级证伪(BUG-1240):`<repo>/docs/research/rectification_nadi_seconds_2026_10_05.md`——第 4 / 第 5 层小运和等分 D150 对安慰剂日期,预先登记的 N1、N2、N3、N5 都不过门;换岁差时第 5 层和 D150 的变化超过 20%。`closed_by_design`。不立实现单,对外不说秒级。
|
||||
- 2026-12-05 盲挑检验:`<repo>/docs/research/rectification_blind_pick_2026_12_05.md`——真实出生时间 + 4 个随机时间(各距 ≥ 60 分钟)盲挑,生产事件评分挑中 23.1%(瞎猜 20%,z = 0.06);随机时间「对上」经历 87.2% 与真值 86.9% 相同;正对照(年份 ±3 年靠向真值盘)82.2% 证明流程有效。小时级也无区分力;重新打开评分须先过此检验。
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,75 @@
|
||||
# 生时校正盲挑检验:真实出生时间 vs 随机时间(2026-12-05)
|
||||
|
||||
> 产品负责人 2026-12-05 提问:agent 拿用户的人生经历去对候选出生时间,说「这个时间对上了」——换一个随机出生时间,是不是同样能「对上」?候选多、可解释的角度多,总能找到某种匹配(多重比较)。检验:给系统真实时间和几个随机时间,不告诉它哪个是真的,看它能不能稳定挑出真的。
|
||||
> 离线研究,生产代码零改动。数据:`references/real_case_calibration/minute_rectification_holdout_v5.json`(77 例公开 Rodden-AA,964 件维基经历,开放集)。
|
||||
> 脚本:`scripts/research/rectification_blind_pick.py`;测试 `tests/test_rectification_blind_pick.py`。
|
||||
> 结果:`rectification_blind_pick_2026_12_05.json`(真实经历 + 伪造经历对照)、`rectification_blind_pick_positive_control_2026_12_05.json`(正对照)。两份均两次运行逐字节一致(随机种子为固定字符串)。
|
||||
> 引擎:`next` `e86351b2` 的生产事件评分 `compute_event_candidate_rows`,全部计算层(`missing_layers` 为空),岁差 raman、平均交点。
|
||||
|
||||
## 1. 结论
|
||||
|
||||
**挑不出来。** 真实时间与 4 个随机时间(各距真值 ≥ 60 分钟,即完全不同的盘)一起盲挑,引擎把真实时间排第一的比例是 **23.1%**,瞎猜是 **20%**;真实时间在全部随机时间里的平均排位 0.498(瞎猜 0.5,z = 0.06)。**随机时间的盘「对上」的经历比例(87.2%)和真实时间(86.9%)一样**——「这件事对上了」对任何时间都成立。
|
||||
|
||||
正对照证明流程能测出信号:把每件经历的年份在 ±3 年内挪到最合真实时间盘的那一年,真实时间挑中率升到 **82.2%**、平均排位 0.096。真实经历里没有这样的信号。
|
||||
|
||||
判定:事件评分对出生时间**没有区分力**,不止分钟级,小时级(不同上升、不同宫位)也分不开。2026-11-17 起暂停的答题与事件评分(#323 / BUG-1966)不应在没有通过本检验的新方法前重新打开;任何对用户说「这个时间对上了」的文案都没有依据。
|
||||
|
||||
## 2. 预先登记的设计(第一次运行前写定)
|
||||
|
||||
| 项 | 设定 |
|
||||
| --- | --- |
|
||||
| 候选 | 每例出生当日全天 96 个时刻,每 15 分钟一个,网格对齐使记录时间恰为其一 |
|
||||
| 主检验 | 一选五盲挑:真值 + 从诱饵池随机抽 4 个;引擎最高分即「挑中」,并列平分;每例 4000 次取均值;瞎猜 = 0.20 |
|
||||
| 诱饵池 | 距真值(按 24 小时循环计)≥ 60 分钟的网格时刻;另报 ≥ 120 分钟、15–120 分钟两档 |
|
||||
| 次要指标 | 真值在「真值 + 诱饵池」中的排位分位(0 = 最好,瞎猜均值 0.5,z 按均匀分布方差);真值进前 20% 的例数 |
|
||||
| 伪造经历对照 | 同一人、同样件数 / 领域 / 精度,每件日期在本人最早与最晚经历年份之间重抽(5 个种子);必须落在瞎猜水平,否则说明引擎因经历以外的原因偏向记录时间 |
|
||||
| 正对照 | 每件经历按年精度,在 ±3 年内挑对真实时间单件得分最高的年份;流程有效则真值必须明显胜出 |
|
||||
| 巴纳姆检查 | 得到正分(「对上」)的经历占比:真值 vs 诱饵平均 |
|
||||
| 子集 | 全部 77 例;未参与调参的 57 例(非继承自 v4) |
|
||||
|
||||
## 3. 结果
|
||||
|
||||
一选五挑中率(± 标准误)与平均排位:
|
||||
|
||||
| 诱饵设定 | 子集 | 挑中率 | 平均排位 | z | 真值进前 20% | 「对上」经历:真值 / 随机 |
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
| ≥ 60 分钟(主) | 全部 77 | 0.231 ± 0.036 | 0.498 | 0.06 | 17 / 77 | 0.869 / 0.872 |
|
||||
| ≥ 60 分钟 | 未调参 57 | 0.218 ± 0.042 | 0.520 | −0.52 | 12 / 57 | 0.845 / 0.876 |
|
||||
| ≥ 60 分钟 | 伪造经历对照 | 0.190 ± 0.014 | 0.524 | −1.64 | 63 / 385 | 0.860 / 0.859 |
|
||||
| ≥ 120 分钟 | 全部 77 | 0.237 ± 0.037 | 0.498 | 0.06 | 17 / 77 | 0.869 / 0.873 |
|
||||
| ≥ 120 分钟 | 未调参 57 | 0.227 ± 0.043 | 0.517 | −0.44 | 12 / 57 | 0.845 / 0.878 |
|
||||
| ≥ 120 分钟 | 伪造经历对照 | 0.195 ± 0.014 | 0.526 | −1.76 | 71 / 385 | 0.860 / 0.860 |
|
||||
| 15–120 分钟 | 全部 77 | 0.219 ± 0.036 | 0.500 | −0.01 | 23 / 77 | 0.869 / 0.864 |
|
||||
| 15–120 分钟 | 未调参 57 | 0.173 ± 0.038 | 0.554 | −1.42 | 14 / 57 | 0.845 / 0.854 |
|
||||
| 15–120 分钟 | 伪造经历对照 | 0.190 ± 0.015 | 0.507 | −0.50 | 87 / 385 | 0.860 / 0.849 |
|
||||
| **≥ 60 分钟,正对照** | 全部 77 | **0.822 ± 0.034** | **0.096** | **12.29** | **68 / 77** | 0.774 / 0.736 |
|
||||
| ≥ 60 分钟,正对照 | 未调参 57 | 0.820 ± 0.040 | 0.108 | 10.26 | 51 / 57 | 0.723 / 0.715 |
|
||||
|
||||
伪造经历对照的 n = 77 × 5 种子 = 385,标准误按 385 行计、偏乐观,只作水平参照。
|
||||
|
||||
读法:
|
||||
|
||||
1. 真实经历三档全部在瞎猜的一个标准误之内;伪造经历同样在瞎猜水平,引擎对记录时间没有经历以外的偏好。
|
||||
2. 正对照只把年份挪了 ±3 年,挑中率就到 82%:只要经历里真有指向真值的信号,这套流程测得出来。
|
||||
3. 正对照里「对上」比例真值 77% vs 随机 74%,几乎没差,挑中率却是 82% vs 20%——**「对上了几件」本身不是证据**,有没有区分力要看与随机时间相比的排名。
|
||||
|
||||
## 4. 与既往研究的关系
|
||||
|
||||
- 与 09-14 定论页、09-29 打分研究、10-01 角度技法、10-05 纳迪秒级的结论一致:在公开传记经历上,事件匹配找不到出生时间信号。本检验把范围从「相邻分钟」扩到「全天不同的盘」,同样无信号。
|
||||
- 09 月「六题回放头名 0.64」等数字的答案是按真实时间的盘作答的(上帝视角),性质上与本文正对照相同,不是区分力证据。
|
||||
|
||||
## 5. 未覆盖与边界
|
||||
|
||||
- 未测 AI 叙述层(无模型凭据)。叙述的依据就是这套评分。
|
||||
- 经历多为年精度(维基)。真实用户可能记得月 / 日,但 1 分钟出生时间差约对应大运推移 3.8 天(09-29 研究),提升有上限;若要重新打开评分,须先在月 / 日精度的独立数据上通过本检验。
|
||||
- 开放集、非盲测;v4 继承的 20 例曾用于调参,另列未调参 57 例,结论不变。
|
||||
|
||||
## 6. 复现
|
||||
|
||||
```bash
|
||||
python scripts/research/rectification_blind_pick.py --out docs/research/rectification_blind_pick_2026_12_05.json # 约 3 分钟
|
||||
python scripts/research/rectification_blind_pick.py --positive-control --out docs/research/rectification_blind_pick_positive_control_2026_12_05.json # 约 1 分钟
|
||||
python -m pytest tests/test_rectification_blind_pick.py -q
|
||||
```
|
||||
|
||||
**重新打开评分的门槛(建议)**:任何新评分方法须在本检验的主设定下,真实经历挑中率显著高于 0.20(预先登记、未调参子集上),且伪造经历对照保持在瞎猜水平。
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,206 @@
|
||||
"""Blind-pick test for the rectification event scorer (2026-12-05).
|
||||
|
||||
Question (product owner): if the agent matches a person's life events against candidate birth times and says
|
||||
"this time fits", would a random birth time "fit" just as well? Many candidates times many interpretive angles
|
||||
always yield some match (multiple comparisons). Test: give the scorer the recorded time and random times, do
|
||||
not say which is real, and see whether it picks the real one more often than chance.
|
||||
|
||||
Pre-registered design (fixed before the first run):
|
||||
- Data: v5 holdout, 77 public Rodden-AA cases, 964 dated life events.
|
||||
- Scorer: the production event engine `compute_event_candidate_rows`, all layers, the dataset's ayanamsa / node mode.
|
||||
- Candidates per case: 96 times on the birth date every 15 minutes, aligned so the recorded time is one of them.
|
||||
- PRIMARY: 1-of-5 blind pick. Truth plus 4 decoys drawn from the grid times at least 60 minutes (circular) from
|
||||
the truth; the scorer "picks" the top score, ties split evenly. 4000 draws per case; chance = 0.20.
|
||||
- SECONDARY: truth's percentile among truth + decoy pool (0 = best, chance mean 0.5); cases with truth in top 20%.
|
||||
Also decoys >= 120 min and 15-120 min.
|
||||
- NEGATIVE CONTROL: same people, same event count / domains / precision, each event's date redrawn uniformly between
|
||||
that person's earliest and latest event year (5 seeds). Must sit at chance.
|
||||
- POSITIVE CONTROL (`--positive-control`): each event's year moved within +-3 years to the year that best suits the
|
||||
recorded time's own chart. If the harness can detect a signal, truth must win clearly.
|
||||
- BARNUM CHECK: share of events earning positive points ("matched") for truth vs for decoys.
|
||||
|
||||
Offline only; public cases only; does not touch production defaults.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import math
|
||||
import random
|
||||
import statistics
|
||||
import sys
|
||||
from datetime import datetime, timedelta
|
||||
from pathlib import Path
|
||||
from typing import Any, Sequence
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
for path in (ROOT, ROOT / "scripts"):
|
||||
if str(path) not in sys.path:
|
||||
sys.path.insert(0, str(path))
|
||||
|
||||
HOLDOUT_V5 = ROOT / "references" / "real_case_calibration" / "minute_rectification_holdout_v5.json"
|
||||
STEP_MINUTES = 15
|
||||
DRAWS = 4000
|
||||
CONTROL_SEEDS = (11, 22, 33, 44, 55)
|
||||
DESIGNS = {"far_60plus": (60, 720), "far_120plus": (120, 720), "near_15_to_120": (15, 120)}
|
||||
POSITIVE_NUDGE_YEARS = 3
|
||||
|
||||
Scored = tuple[int, float, float] # (minute of day, score, share of events matched)
|
||||
|
||||
|
||||
def circular_minutes(a: int, b: int) -> int:
|
||||
d = abs(a - b) % 1440
|
||||
return min(d, 1440 - d)
|
||||
|
||||
|
||||
def grid_times(truth: datetime, step: int = STEP_MINUTES) -> list[datetime]:
|
||||
"""Every `step` minutes on the truth's calendar date, the truth itself included."""
|
||||
return [datetime.combine(truth.date(), (truth + timedelta(minutes=step * k)).time()) for k in range(1440 // step)]
|
||||
|
||||
|
||||
def plain_events(case: dict[str, Any]) -> list[dict[str, Any]]:
|
||||
return [{"id": e["id"], "domain": e["domain"], "date": e["date"], "precision": e["precision"]} for e in case["events"]]
|
||||
|
||||
|
||||
def base_request(case: dict[str, Any], data: dict[str, Any]) -> dict[str, Any]:
|
||||
b = case["birth"]
|
||||
return {"birth_date": b["date"], "start_time": "00:00", "end_time": "23:59", "lat": b["latitude"],
|
||||
"lon": b["longitude"], "tz": b["timezone_offset"], "ayanamsa": data["ayanamsa"],
|
||||
"node_mode": data["node_mode"], "minute_step": 1}
|
||||
|
||||
|
||||
def truth_time(case: dict[str, Any]) -> datetime:
|
||||
b = case["birth"]
|
||||
return datetime.strptime(f"{b['date']} {b['time']}", "%Y-%m-%d %H:%M")
|
||||
|
||||
|
||||
def score_grid(case: dict[str, Any], data: dict[str, Any], events: list[dict[str, Any]]) -> list[Scored]:
|
||||
from scripts.active_rectification_event_engine import compute_event_candidate_rows
|
||||
|
||||
cands = grid_times(truth_time(case))
|
||||
rows = compute_event_candidate_rows({**base_request(case, data), "events": events}, candidates=cands)
|
||||
n_events = max(1, len(events))
|
||||
out: list[Scored] = []
|
||||
for cand, row in zip(cands, rows):
|
||||
matched = {e["event_id"] for e in row["evidence"] if e.get("points", 0) > 0}
|
||||
out.append((cand.hour * 60 + cand.minute, float(row["score"]), len(matched) / n_events))
|
||||
return out
|
||||
|
||||
|
||||
def evaluate(scored: Sequence[Scored], truth_minute: int, decoy_min: int, decoy_max: int,
|
||||
rng: random.Random, draws: int = DRAWS) -> dict[str, Any]:
|
||||
truth = next(s for s in scored if s[0] == truth_minute)
|
||||
pool = [s for s in scored if decoy_min <= circular_minutes(s[0], truth_minute) <= decoy_max]
|
||||
hit = 0.0
|
||||
for _ in range(draws):
|
||||
scores = [truth[1]] + [d[1] for d in rng.sample(pool, 4)]
|
||||
best = max(scores)
|
||||
if truth[1] == best:
|
||||
hit += 1 / scores.count(best)
|
||||
better = sum(1 for p in pool if p[1] > truth[1])
|
||||
ties = sum(1 for p in pool if p[1] == truth[1])
|
||||
pct = (better + ties / 2) / len(pool)
|
||||
return {"hit": hit / draws, "pct": pct, "top20": pct < 0.2,
|
||||
"match_truth": truth[2], "match_decoy": statistics.mean(p[2] for p in pool)}
|
||||
|
||||
|
||||
def fake_events(case: dict[str, Any], rng: random.Random) -> list[dict[str, Any]]:
|
||||
years = [int(e["date"][:4]) for e in case["events"]]
|
||||
lo, hi = min(years), max(years)
|
||||
out = []
|
||||
for e in case["events"]:
|
||||
y = rng.randint(lo, hi)
|
||||
if e["precision"] == "year":
|
||||
date = f"{y}"
|
||||
elif e["precision"] == "month":
|
||||
date = f"{y}-{rng.randint(1, 12):02d}"
|
||||
else:
|
||||
date = f"{y}-{rng.randint(1, 12):02d}-{rng.randint(1, 28):02d}"
|
||||
out.append({"id": e["id"], "domain": e["domain"], "date": date, "precision": e["precision"]})
|
||||
return out
|
||||
|
||||
|
||||
def truth_favoured_events(case: dict[str, Any], data: dict[str, Any]) -> list[dict[str, Any]]:
|
||||
"""Positive control: each event moved to the year (within +-3) that scores best for the recorded time."""
|
||||
from scripts.active_rectification_event_engine import compute_event_candidate_rows
|
||||
|
||||
truth = truth_time(case)
|
||||
base = base_request(case, data)
|
||||
out = []
|
||||
for e in case["events"]:
|
||||
y = int(e["date"][:4])
|
||||
best: tuple[float, dict[str, Any]] | None = None
|
||||
for yy in range(y - POSITIVE_NUDGE_YEARS, y + POSITIVE_NUDGE_YEARS + 1):
|
||||
ev = {"id": e["id"], "domain": e["domain"], "date": str(yy), "precision": "year"}
|
||||
s = compute_event_candidate_rows({**base, "events": [ev]}, candidates=[truth])[0]["score"]
|
||||
if best is None or s > best[0]:
|
||||
best = (s, ev)
|
||||
assert best is not None
|
||||
out.append(best[1])
|
||||
return out
|
||||
|
||||
|
||||
def summarize(rows: Sequence[dict[str, Any]]) -> dict[str, Any]:
|
||||
n = len(rows)
|
||||
hits = [r["hit"] for r in rows]
|
||||
pcts = [r["pct"] for r in rows]
|
||||
mean_pct = statistics.mean(pcts)
|
||||
return {"n": n, "pick1of5": round(statistics.mean(hits), 3),
|
||||
"pick_se": round(statistics.pstdev(hits) / math.sqrt(n), 3),
|
||||
"mean_percentile": round(mean_pct, 3),
|
||||
"z_vs_chance": round((0.5 - mean_pct) / (math.sqrt(1 / 12) / math.sqrt(n)), 2),
|
||||
"truth_top20_cases": sum(r["top20"] for r in rows),
|
||||
"events_matched_truth": round(statistics.mean(r["match_truth"] for r in rows), 3),
|
||||
"events_matched_decoy": round(statistics.mean(r["match_decoy"] for r in rows), 3)}
|
||||
|
||||
|
||||
def run(data: dict[str, Any], *, positive_control: bool = False) -> dict[str, Any]:
|
||||
real: dict[str, list[dict[str, Any]]] = {k: [] for k in DESIGNS}
|
||||
control: dict[str, list[dict[str, Any]]] = {k: [] for k in DESIGNS}
|
||||
per_case = []
|
||||
for i, case in enumerate(data["cases"]):
|
||||
t = truth_time(case)
|
||||
tmin = t.hour * 60 + t.minute
|
||||
tuning_free = not case.get("inherited_from_v4", False)
|
||||
events = truth_favoured_events(case, data) if positive_control else plain_events(case)
|
||||
scored = score_grid(case, data, events)
|
||||
rec: dict[str, Any] = {"case": case["case_id"], "tuning_free": tuning_free, "events": len(events)}
|
||||
for k, (lo, hi) in DESIGNS.items():
|
||||
r = evaluate(scored, tmin, lo, hi, random.Random(f"{case['case_id']}-{k}"))
|
||||
r["tuning_free"] = tuning_free
|
||||
real[k].append(r)
|
||||
rec[k] = {"hit": round(r["hit"], 3), "pct": round(r["pct"], 3)}
|
||||
if not positive_control:
|
||||
for seed in CONTROL_SEEDS:
|
||||
fscored = score_grid(case, data, fake_events(case, random.Random(f"{case['case_id']}-{seed}")))
|
||||
for k, (lo, hi) in DESIGNS.items():
|
||||
r = evaluate(fscored, tmin, lo, hi, random.Random(f"{case['case_id']}-{k}-{seed}"))
|
||||
r["tuning_free"] = tuning_free
|
||||
control[k].append(r)
|
||||
per_case.append(rec)
|
||||
print(i + 1, case["case_id"], rec["far_60plus"], file=sys.stderr, flush=True)
|
||||
summary: dict[str, Any] = {}
|
||||
for k in DESIGNS:
|
||||
summary[k] = {"real_all": summarize(real[k]),
|
||||
"real_tuning_free": summarize([r for r in real[k] if r["tuning_free"]])}
|
||||
if not positive_control:
|
||||
summary[k]["fake_events_control"] = summarize(control[k])
|
||||
return {"mode": "positive_control" if positive_control else "real_events",
|
||||
"dataset": str(HOLDOUT_V5.relative_to(ROOT)), "step_minutes": STEP_MINUTES, "draws": DRAWS,
|
||||
"summary": summary, "per_case": per_case}
|
||||
|
||||
|
||||
def main(argv: Sequence[str] | None = None) -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
||||
parser.add_argument("--out", type=Path, required=True)
|
||||
parser.add_argument("--positive-control", action="store_true")
|
||||
args = parser.parse_args(argv)
|
||||
data = json.loads(HOLDOUT_V5.read_text(encoding="utf-8"))
|
||||
result = run(data, positive_control=args.positive_control)
|
||||
args.out.write_text(json.dumps(result, ensure_ascii=False, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
print(json.dumps(result["summary"], ensure_ascii=False, indent=2))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,62 @@
|
||||
"""Blind-pick research helpers (2026-12-05). Offline; synthetic score grids, no ephemeris."""
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
from random import Random
|
||||
|
||||
import pytest
|
||||
|
||||
from scripts.research import rectification_blind_pick as bp
|
||||
|
||||
|
||||
def test_circular_minutes_wraps_midnight():
|
||||
assert bp.circular_minutes(10, 1430) == 20
|
||||
assert bp.circular_minutes(0, 720) == 720
|
||||
|
||||
|
||||
def test_grid_keeps_truth_and_date():
|
||||
truth = datetime(1950, 3, 4, 23, 50)
|
||||
grid = bp.grid_times(truth)
|
||||
assert len(grid) == 96
|
||||
assert grid[0] == truth
|
||||
assert {g.date() for g in grid} == {truth.date()}
|
||||
|
||||
|
||||
def _grid(scores: dict[int, float]) -> list[bp.Scored]:
|
||||
return [(m, scores.get(m, 0.0), 0.5) for m in range(0, 1440, 15)]
|
||||
|
||||
|
||||
def test_evaluate_truth_always_best_wins_every_draw():
|
||||
r = bp.evaluate(_grid({600: 9.0}), 600, 60, 720, Random(1), draws=200)
|
||||
assert r["hit"] == 1.0 and r["pct"] == 0.0 and r["top20"]
|
||||
|
||||
|
||||
def test_evaluate_all_tied_is_chance():
|
||||
r = bp.evaluate(_grid({}), 600, 60, 720, Random(1), draws=200)
|
||||
assert r["hit"] == pytest.approx(0.2)
|
||||
assert r["pct"] == pytest.approx(0.5)
|
||||
|
||||
|
||||
def test_evaluate_excludes_near_times_from_far_pool():
|
||||
# A near neighbour with a higher score must not count against truth in the far design.
|
||||
r = bp.evaluate(_grid({600: 5.0, 615: 9.0}), 600, 60, 720, Random(1), draws=200)
|
||||
assert r["hit"] == 1.0
|
||||
|
||||
|
||||
def test_fake_events_keep_shape_and_year_range():
|
||||
case = {"events": [
|
||||
{"id": "a", "domain": "career", "date": "1970", "precision": "year"},
|
||||
{"id": "b", "domain": "family", "date": "1980-05", "precision": "month"},
|
||||
{"id": "c", "domain": "health_pressure", "date": "1990-01-02", "precision": "day"},
|
||||
]}
|
||||
fakes = bp.fake_events(case, Random(3))
|
||||
assert [(f["id"], f["domain"], f["precision"]) for f in fakes] == [
|
||||
("a", "career", "year"), ("b", "family", "month"), ("c", "health_pressure", "day")]
|
||||
assert all(1970 <= int(f["date"][:4]) <= 1990 for f in fakes)
|
||||
assert [len(f["date"]) for f in fakes] == [4, 7, 10]
|
||||
|
||||
|
||||
def test_summarize_reports_chance_z_near_zero():
|
||||
rows = [{"hit": 0.2, "pct": 0.5, "top20": False, "match_truth": 0.8, "match_decoy": 0.8}] * 10
|
||||
s = bp.summarize(rows)
|
||||
assert s["pick1of5"] == 0.2 and s["z_vs_chance"] == 0.0
|
||||
Reference in New Issue
Block a user