checkpoint: 统计引擎确定性——系谱按 id 规范排序,消除 DB 行序对 MME 布局的影响
- _order_pedigree: base 与同世代并列个体均按 id 确定性排序,输入/DB 行序不再参与计算 - 平似然/退化数据上同内容输入必逐位同输出(此前 golden-section/二分会被末位浮点噪声带偏到任意 h²,导致回归间歇失败)
This commit is contained in:
@@ -84,7 +84,14 @@ def _pearson(x: list[float], y: list[float]) -> float:
|
|||||||
|
|
||||||
|
|
||||||
def _order_pedigree(base: list[int], non_base: list[tuple[int, int | None, int | None]]) -> tuple[list[int], dict[int, int]]:
|
def _order_pedigree(base: list[int], non_base: list[tuple[int, int | None, int | None]]) -> tuple[list[int], dict[int, int]]:
|
||||||
"""返回拓扑序(祖先恒在子代之前,base 恒在最前)与 {个体id: 序号}。"""
|
"""返回拓扑序(祖先恒在子代之前,base 恒在最前)与 {个体id: 序号}。
|
||||||
|
|
||||||
|
输入顺序不参与计算:base 与同世代并列个体均按 id 确定性排序,调用方/DB 行序不再
|
||||||
|
影响 MME 变量布局——同内容输入必得逐位相同输出(平似然/退化数据上尤其关键,否则
|
||||||
|
golden-section/二分会被末位浮点噪声带偏到任意 h²)。
|
||||||
|
"""
|
||||||
|
base = sorted(base, key=str)
|
||||||
|
non_base = sorted(non_base, key=lambda it: str(it[0]))
|
||||||
order: list[int] = list(base)
|
order: list[int] = list(base)
|
||||||
placed: set[int] = set(base)
|
placed: set[int] = set(base)
|
||||||
remaining = list(non_base)
|
remaining = list(non_base)
|
||||||
|
|||||||
Reference in New Issue
Block a user