From 90be7537185d20eac47787cba7509e231a619e54 Mon Sep 17 00:00:00 2001 From: x Date: Thu, 3 Dec 2026 19:21:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(spatial):=20remove=5Fentity=20=E5=BF=85?= =?UTF-8?q?=E9=A1=BB=E6=8A=8A=E5=AE=9E=E4=BD=93=E5=B8=A6=E8=B5=B0=E7=9A=84?= =?UTF-8?q?=E5=85=B3=E7=B3=BB=E4=B9=9F=E4=B8=80=E8=B5=B7=E5=88=87=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit P 被移走之后,T-P 的接触边仍然在图里,跳数仍然报告 T 被支撑,唯一与"仍被支撑" 相反的证据只有编辑 token 本身——于是"发生过编辑就答 false"成了最省事的自洽规则, area.sup2 三种子稳定停在 0.594/0.617/0.656,正好就是那位一位规则的分数。 现在 remove_entity 会把它入射的边标成已移除,跳数、连通都按干预后的图算。 --- spatial/data.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spatial/data.py b/spatial/data.py index d4981c1..2488066 100644 --- a/spatial/data.py +++ b/spatial/data.py @@ -220,6 +220,15 @@ def collate(batch, max_entities: int = 32): elif edit.get("op") == "remove_entity": edit_op[i] = 2 edit_idx[i] = ids.get(edit.get("entity"), -1) + # an entity that is gone takes its relations with it. Without this + # the post-intervention graph still has T resting on the pedestal it + # just lost, the hop distance still reports support, and the only + # evidence against support is the edit token itself -- which makes + # "an edit happened, answer false" the cheapest consistent rule. + gone = edit.get("entity") + for k, ed in enumerate(sc.obs.edges): + if gone in (ed.a, ed.b): + edge_removed[i, k] = 1.0 answer[i] = ANSWERS.index(sc.label.answer) change[i] = CHANGES.index(sc.label.change)