fix(spatial): remove_entity 必须把实体带走的关系也一起切断
P 被移走之后,T-P 的接触边仍然在图里,跳数仍然报告 T 被支撑,唯一与"仍被支撑" 相反的证据只有编辑 token 本身——于是"发生过编辑就答 false"成了最省事的自洽规则, area.sup2 三种子稳定停在 0.594/0.617/0.656,正好就是那位一位规则的分数。 现在 remove_entity 会把它入射的边标成已移除,跳数、连通都按干预后的图算。
This commit is contained in:
1 parent
1a1cc38fea
commit
90be753718
1 file changed
+9
@@ -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)
|
||||
|
||||
|
||||
Reference in new issue
Block a user