总览 · ← 返回运行 20261003-105537-search-t2-heart-extrap-g24-D
节点 n17
T2HX-06 坐标规范化:copy_last 基座上做质心归零→PCA主轴对齐→det=+1修正→第三矩定向的刚体规范化;A半实测榜分与机制关相同(八项skill全部=地板),按PLAN判定规则以机制关(逐位=copy_last)提交
| 运行?一次完整的自动搜索或 Agent 会话,有自己的锁定配置和证据包。 | 20261003-105537-search-t2-heart-extrap-g24-D |
|---|---|
| 父节点 | n13 |
| 子节点 | n18 |
| 操作?种子:人写的起点;改进:在父节点上改;草稿:从头写;修复:修父节点的报错。 | 改进 |
| 状态 | 已打分 |
| 分数 | 搜索目标分 50.00(+0.0) · proxy_noscale 50.00(+0.0) |
| 审查 | 未审查 |
| 用时?从运行开始到结束(或到现在)的挂钟时间。 | 11 分 |
| 程序版本 | 7586402eb42866b574f9732f1bf082ba7834daf2 (programs.git) |
方法说明?节点程序自带的 METHOD.md:这个程序做了什么、为什么。
来自 programs.git 7586402eb4:solution/METHOD.md
T2HX-06 坐标规范化:copy_last 基座上做质心归零→PCA主轴对齐→det=+1修正→第三矩定向的刚体规范化;A半实测榜分与机制关相同(八项skill全部=地板),按PLAN判定规则以机制关(逐位=copy_last)提交
方法(PLAN 家族 T2HX-06,机制完整实现,开关 VEC_CANON,提交态默认 0=关)
- 基座:
anchor_entry锚阶段整份输出(n=24826 ≤ max_cells=25179,无抽样),表达矩阵、行序、基因序逐位不动,只允许坐标做刚体变换。 - 机制(
VEC_CANON=1):(1) 减质心;(2) 协方差eigh→ 特征值降序排列主轴,旋转;(3) det(R)<0 则翻最后一轴,保证真旋转;(4) 各轴按第三矩符号定向(使 m3>0),特征值近简并(λ_{j+1}/λ_j>0.95,VEC_DEGEN)或 |m3|<1e-9·rms³ 的轴跳过定向;若定向翻转数为奇数,撤销 |m3| 最小轴的翻转——总变换保持 det=+1,绝不镜像点云(镜像是生物学错误,且利用评分器只搜 4 种 det=+1 翻转的镜像盲区属于规则明令禁止的 scorer gaming)。 - 单输入阶段退路:机制只用坐标,不需两阶段差分,任意输入数可跑。
- 视图无关:不读 board/mode/路径,不依赖绝对时间(anchor 按“时间差”选,统一平移不变),输出只取决于视图数据与 seed。
机制生效证据(PLAN mechanism_evidence 对应项)
- 规范化数值(VEC_DEBUG 打印,seed 0):质心≈0(锚坐标本已居中,‖centroid‖~1e-13);特征值 [18720.2, 16467.3, 11849.9],λ比 0.88/0.72,无近简并、无跳过轴;det_R=+1.000000;第三矩 pre=[+105092, −470136, +46267]。
- 第三矩定向被 det=+1 守卫撤销:唯一 m3<0 的轴(轴1)翻转会使总 det=−1(镜像),按守卫撤销 → flips=[],点云只被 PCA 旋转。这是刻意的:det=+1 的任何符号构型评分器自己都会枚举,规范化无信息增益;det=−1(镜像)被规则禁止。
- 不变量核验:off 态输出 sha256=a26c0b78ed1aa4c4…与父节点 copy_last 逐位一致;on 态两次运行(on.h5ad / on2.h5ad)sha256 相同(确定性);seed 1 亦通过 vec-check。表达矩阵、行序、细胞数、点集内在几何(全部点对距离)off/on 相同。
- 四组分对比(on vs off,A半):expression_change 与 cell_state 原始值逐位相同(de=0/0,mmd_u=0.05856,variogram=0.058616,nb=0.11445);shape_scale 的 d2_shape 0.04911→0.04891、occupancy_dice 0.8066→0.8148、scale_log_ratio −0.4334→−0.4375 出现小幅漂移(刚体不变量理论上不动,漂移来自评分器对旋转后坐标重算 PCA 对齐/占据网格的浮点与抽样路径),但八项 skill 全部仍=0.5,组分与榜分不变。
机制关对照(PLAN mechanism_off_control)
- VEC_CANON=0(提交默认):跳过规范化,输出与 copy_last 逐位一致(同 sha256),分数=父节点实测 50.00(同一文件评分 σ=0,不重复查分)。
- VEC_CANON=1:
vec-score --task T2:heart:val_extrap/proxy_noscale实测 50.00(1 次查分,quota_left=19),所有 skill=0.5。
PLAN 判定规则执行
榜分 50.00 不 >50.5 → 按 PLAN 步骤(4) 提交未规范化版(=copy_last 逐位)。机制假设(“copy_last 的原始坐标方向不在评分器 4 种翻转能覆盖的最优对齐上”)被证伪:occupancy_dice 在评分器内部已做质心归零+主轴对齐+4 种 det=+1 翻转取最优,提交前再做 det=+1 刚体规范化是恒等变换(score-wise);唯一能改变 occupancy 的是镜像(det=−1),而那属于规则禁止的镜像盲区利用且生物学上错误(心脏左右手性固定)。文献 k026 “刚体旋转可使形状分变化>噪声”在本榜的 det=+1 子空间内不成立。
已验证 / 未验证
- 已验证:off=copy_last 逐位(sha 比对);on 确定性(两次运行同 sha);seed 0/1 均通过 vec-check;on 态 A 半 50.00。
- 未验证:B 半分数(同规则同地板,on 为刚体变换预期同为地板);伪装视图重跑(代码无视图/绝对时间依赖,预期通过)。
- 生物学知识来源:仅“心脏手性固定、镜像胚胎非真实形态”这一通用发育常识;未使用任何保留阶段/基因型的测量信息,未硬编码任何由已发布阶段算出的常数。
结论与下一步
T2HX-06 双向证伪(刚体规范化=恒等;镜像=禁止)。连同 ANALYSIS 的结论,本榜 copy_last 基座上的视图内几何/表达微扰族(T2HX-01/02/03/04/06)已全部穷尽且均≤地板。下一步若在本榜找增量,只剩“引入视图外时间方向信息”的跨阶段配对型内细化(ANALYSIS next_suggestions 2),且须先离线验证 std(dp)<1%·std(dt) 硬门槛。
调研员的计划
| 名称 | T2HX-06 坐标规范化:PCA主轴+手性固定消除形状评分方向方差 |
|---|---|
| 动机 | 父节点13及全树17个节点中,除node5(52.74,未复现)外全部停在地板50.00。ANALYSIS明确关闭视图内微扰族。方向库标注T2HX-06为'本榜最需要'且从未被尝试。文献k026记录:形状指标PCA对齐不固定行列式,同一预测的刚体旋转可使形状分变化超过噪声(>1分)。当前copy_last输出的坐标方向是原始数据给定的任意方向,可能不在评分器4种det=+1翻转能覆盖的最优对齐上。 |
| 做法 | 步骤:(1) 从anchor_entry读末输入阶段,输出copy_last(X、坐标、行序不变);(2) 对坐标做规范化:减质心→PCA旋转(按特征值降序排列主轴)→强制det=+1(若det<0则翻转最后一轴)→按各轴第三矩符号定向(使第三矩为正);(3) 表达矩阵、行序、基因序完全不动;(4) vec-score查分,若榜分>50.5则提交规范化版,否则提交未规范化版(=copy_last)。关键参数:无搜索参数,规范化是确定性流程。单输入阶段退路:只有一个阶段时仍可做规范化(只需坐标,不需两阶段差分)。若PCA特征值近简并(λ2/λ3>0.95),跳过该轴定向以避免不稳定。用vec-score一次查分即可判定(噪声~1分,>50.5才有意义)。 |
| 风险 | 1) 评分器occupancy_dice已做4种翻转取最优,规范化可能无额外收益(发现方式:查分后形状组无变化);2) PCA近简并导致主轴不稳定,规范化引入随机性(发现方式:两次运行输出不同,加特征值比检查);3) 规范化后行序不变但坐标值变,理论上不影响occupancy_dice抽样(它按细胞数抽,不按行序),但需确认。Engineer应在实现后先打印特征值比和det,确认规范化稳定。 |
代码改动?这个节点的程序和父节点程序的逐行差别:绿色是新增,红色是删除。
对比:父节点版本 9fc2b13a32。改动的文件:solution/METHOD.md +20 −28、solution/run.py +80 −163
diff --git a/solution/METHOD.md b/solution/METHOD.mdindex 61d4264..e97c2a7 100644--- a/solution/METHOD.md+++ b/solution/METHOD.md@@ -1,42 +1,34 @@-# T2HX-04 微小全局位移(α=0.02)+表达引导坐标2-opt置换:位移clip伪影在α=0.02即击穿DE保护(49.10),置换仅降能量0.31%、无邻域收益(48.87),按PLAN止损以机制关(=copy_last逐位)提交+# T2HX-06 坐标规范化:copy_last 基座上做质心归零→PCA主轴对齐→det=+1修正→第三矩定向的刚体规范化;A半实测榜分与机制关相同(八项skill全部=地板),按PLAN判定规则以机制关(逐位=copy_last)提交 -## 方法(PLAN 家族 T2HX-04,机制完整实现,开关默认关)+## 方法(PLAN 家族 T2HX-06,机制完整实现,开关 VEC_CANON,提交态默认 0=关) -- 基座:`anchor_entry` 锚阶段整份输出(n=24826 ≤ max_cells=25179,无抽样),坐标点集、表达值、基因序不变;置换只重排细胞↔坐标配对。-- 阶段A(`VEC_ALPHA`):`extrap_step(manifest)` 现场取倒数两输入(E8.25_late→E8.75),v = pb(late)−pb(early)(全细胞伪批量),X ← clip(X + α·v, 0),全局统一方向(非按型)。单输入阶段自动跳过。-- 阶段B(`VEC_SWAP`=B%):坐标 15-NN(cKDTree)取并集对称图;贪心 2-opt 最小化图上表达余弦距离总和(Dirichlet 能量)。候选用快速近似 gain(i,j) = (x_j−x_i)·(N_i−N_j)(N=邻居单位向量和,批量矩阵化),每对候选先做**精确能量差验证**(含共邻/相邻修正)再执行;best-first,预算 B%·n 或无改善对或超时停止。-- 开关:`VEC_ALPHA`(默认 0=关)、`VEC_SWAP`(默认 0=关)、`VEC_EPS/ROUNDS/KNN/TIMECAP`。只用 manifest 阶段顺序与视图内数据,无视图路径、阶段名、绝对时间分支。--## 网格结果(vec-score T2:heart:val_extrap/proxy_noscale,A 半,共用 2 次查分)--| 配置 | 榜分 | de_score | variogram | mmd_u | neighborhood_mmd | occupancy_dice |-|---|---:|---:|---:|---:|---:|---:|-| identity(父节点实测,=copy_last) | 50.00 | 0 | 0.058616 | 0.05856 | 0.11445 | 0.8066 |-| α=0.02, B=0(只开位移) | 49.10 | −0.125 | 0.064552 | 0.05871 | 0.11463 | 0.8148 |-| α=0.02, B=2%(PLAN 首档完整方案) | **48.87** | −0.125 | 0.064552 | 0.05871 | 0.11459 | 0.8131 |+- 基座:`anchor_entry` 锚阶段整份输出(n=24826 ≤ max_cells=25179,无抽样),表达矩阵、行序、基因序逐位不动,只允许坐标做刚体变换。+- 机制(`VEC_CANON=1`):(1) 减质心;(2) 协方差 `eigh` → 特征值降序排列主轴,旋转;(3) det(R)<0 则翻最后一轴,保证真旋转;(4) 各轴按第三矩符号定向(使 m3>0),特征值近简并(λ_{j+1}/λ_j>0.95,`VEC_DEGEN`)或 |m3|<1e-9·rms³ 的轴跳过定向;**若定向翻转数为奇数,撤销 |m3| 最小轴的翻转**——总变换保持 det=+1,绝不镜像点云(镜像是生物学错误,且利用评分器只搜 4 种 det=+1 翻转的镜像盲区属于规则明令禁止的 scorer gaming)。+- 单输入阶段退路:机制只用坐标,不需两阶段差分,任意输入数可跑。+- 视图无关:不读 board/mode/路径,不依赖绝对时间(anchor 按“时间差”选,统一平移不变),输出只取决于视图数据与 seed。 ## 机制生效证据(PLAN mechanism_evidence 对应项) -1. **置换统计**:预算 497 对,3 轮扫描只找到 **75** 对精确增益 >EPS 的改善交换即收敛(无改善交换停止);能量 E0=105046.8 → E1=104718.5,**只降 0.313%** —— 位移后 copy_last 配对仍是坐标-15NN Dirichlet 能量的强局部最优,PLAN 核心假设(微小位移打破局部最优、释放置换收益)**不成立**。-2. **邻域变化**:置换使 neighborhood_mmd 0.11463→0.11459(≈0,A 半 σ=0 下真实但无意义);且 occupancy_dice 0.8148→0.8131 —— 配对重排虽不动坐标点集,仍通过行序影响评分器占据抽样,反伤 shape_scale(与节点 7/9 官方分 shape 掉到 48 的观察一致)。-3. **四组分对比**(α=0.02+B=2% vs α=0.02+B=0 vs identity):expression_change 50→47.72(两档相同,全部来自位移的 clip 伪影);cell_state 50→48.75(variogram 0.0586→0.0646,与节点 11 同族恶化);local_spatial 50→49.96;shape_scale 50→49.05(置换再扣 occupancy)。-4. **DE 保护自检**(PLAN 风险3):α=0.02 时 std(dp)=0.00452、max|dp|=0.0236、clip(0) 命中 8.10M 条目(≈65%)——PLAN 假设"α≤0.03 时 clip 伪影极小、保护不击穿"**被证伪**:de_score=−0.125、de_direction=−0.0598,保护已击穿(复刻 node6/11 失败模式,且阈值比节点 11 的 α≥0.20 低一个量级——均匀位移 v 的 std(v)=0.41 比 PCA 缩放残差大得多)。+1. **规范化数值**(VEC_DEBUG 打印,seed 0):质心≈0(锚坐标本已居中,‖centroid‖~1e-13);特征值 [18720.2, 16467.3, 11849.9],λ比 0.88/0.72,无近简并、无跳过轴;det_R=+1.000000;第三矩 pre=[+105092, −470136, +46267]。+2. **第三矩定向被 det=+1 守卫撤销**:唯一 m3<0 的轴(轴1)翻转会使总 det=−1(镜像),按守卫撤销 → flips=[],点云只被 PCA 旋转。这是刻意的:det=+1 的任何符号构型评分器自己都会枚举,规范化无信息增益;det=−1(镜像)被规则禁止。+3. **不变量核验**:off 态输出 sha256=a26c0b78ed1aa4c4…与父节点 copy_last **逐位一致**;on 态两次运行(on.h5ad / on2.h5ad)sha256 相同(确定性);seed 1 亦通过 vec-check。表达矩阵、行序、细胞数、点集内在几何(全部点对距离)off/on 相同。+4. **四组分对比**(on vs off,A半):expression_change 与 cell_state 原始值逐位相同(de=0/0,mmd_u=0.05856,variogram=0.058616,nb=0.11445);shape_scale 的 d2_shape 0.04911→0.04891、occupancy_dice 0.8066→0.8148、scale_log_ratio −0.4334→−0.4375 出现小幅漂移(刚体不变量理论上不动,漂移来自评分器对旋转后坐标重算 PCA 对齐/占据网格的浮点与抽样路径),但八项 skill 全部仍=0.5,组分与榜分不变。 ## 机制关对照(PLAN mechanism_off_control) -VEC_ALPHA=0 且 VEC_SWAP=0(提交默认):跳过两阶段,输出与 copy_last **逐位一致**(sha256 a26c0b78ed1aa4c4…,seed 0 两次运行相同;seed 1 的 .X 与 obsm 逐位相同,仅 uns.generator_seed 字段不同)。预期分数 = 50.00(父节点/节点 1/3/6/8/10/11 提交态实测)。"位移单独开"档 49.10 < identity,证明本方案无任何一档优于机制关。+- VEC_CANON=0(提交默认):跳过规范化,输出与 copy_last 逐位一致(同 sha256),分数=父节点实测 50.00(同一文件评分 σ=0,不重复查分)。+- VEC_CANON=1:`vec-score --task T2:heart:val_extrap/proxy_noscale` 实测 **50.00**(1 次查分,quota_left=19),所有 skill=0.5。 -## PLAN 止损执行+## PLAN 判定规则执行 -PLAN 步骤(5)/风险1:首档(α=0.02, B=2%)= 48.87 ≤ 50.00 → 立即止损,提交 off,不再追加 α×B 网格(位移在 α=0.02 已击穿 DE 保护,更小 α 只会同时缩小"破局"与收益;置换独立收益已被 75/497、0.313%、nb Δ≈0 三个数判死)。+榜分 50.00 不 >50.5 → 按 PLAN 步骤(4) 提交**未规范化版**(=copy_last 逐位)。机制假设(“copy_last 的原始坐标方向不在评分器 4 种翻转能覆盖的最优对齐上”)**被证伪**:occupancy_dice 在评分器内部已做质心归零+主轴对齐+4 种 det=+1 翻转取最优,提交前再做 det=+1 刚体规范化是恒等变换(score-wise);唯一能改变 occupancy 的是镜像(det=−1),而那属于规则禁止的镜像盲区利用且生物学上错误(心脏左右手性固定)。文献 k026 “刚体旋转可使形状分变化>噪声”在本榜的 det=+1 子空间内不成立。 -## 验证过 / 没验证过+## 已验证 / 未验证 -- 验证过:提交态 `vec-check --task T2:heart:val_extrap/proxy_noscale` = ok(注意:`--data` 形式的 vec-check 在本客户端被拒 "task not allowed",需带尺子后缀的 --task);seed 0/1 的 .X、坐标逐位一致;CPU 运行提交态 ~4 s、机制开启态 ~110 s,内存 <1.5 GB(limits 28 GB/30 min 内);单输入阶段回退(prev=None 跳过位移,置换仍可跑)。-- 没验证过:B 半与伪装视图(提交态与父节点逐位相同,无迁移风险;代码只读 manifest 数据与相对顺序,无绝对时间/路径分支);真实 final 视图(3 输入时 v 取倒数两输入,机制默认关,不影响提交态);B>2% 或更小 α 的完整网格(止损规则)。+- 已验证:off=copy_last 逐位(sha 比对);on 确定性(两次运行同 sha);seed 0/1 均通过 vec-check;on 态 A 半 50.00。+- 未验证:B 半分数(同规则同地板,on 为刚体变换预期同为地板);伪装视图重跑(代码无视图/绝对时间依赖,预期通过)。+- 生物学知识来源:仅“心脏手性固定、镜像胚胎非真实形态”这一通用发育常识;未使用任何保留阶段/基因型的测量信息,未硬编码任何由已发布阶段算出的常数。 -## 给树的结论+## 结论与下一步 -- T2HX-04 在本榜**两种形态均证伪**:纯 copy_last 基座上的有界置换(节点 7/9/10:49.60/49.60/50.00)与"微小全局位移破局+置换"(本节点:48.87)。坐标-15NN 配对能量在 copy_last 处已近局部最优(可改善交换 <0.4% 细胞、能量降 0.3%),任何位移预处理都不改变这一事实;置换还会经行序扰动 occupancy_dice。-- 均匀伪批量位移的 clip 伪影击穿 DE 保护的阈值远低于 PCA 缩放族(α≈0.02 vs 0.20):std(v)=0.41 的全局方向上 α=0.02 就产生 de_score<0。改表达值方案的安全边界应按 std(dp) 而非 α 标定。-- 与节点 11 结论合并:copy_last 基座上均值位移、方差缩放、配对重排及其组合已全部证伪,本榜视图内微扰族关闭;剩余杠杆只有引入视图外时间方向信息(跨阶段配对建模),或接受地板 50.00。+T2HX-06 双向证伪(刚体规范化=恒等;镜像=禁止)。连同 ANALYSIS 的结论,本榜 copy_last 基座上的视图内几何/表达微扰族(T2HX-01/02/03/04/06)已全部穷尽且均≤地板。下一步若在本榜找增量,只剩“引入视图外时间方向信息”的跨阶段配对型内细化(ANALYSIS next_suggestions 2),且须先离线验证 std(dp)<1%·std(dt) 硬门槛。diff --git a/solution/run.py b/solution/run.pyindex 6ede9b6..d792e6c 100644--- a/solution/run.py+++ b/solution/run.py@@ -1,160 +1,96 @@ #!/usr/bin/env python3-"""T2HX-04: micro global expression shift + expression-kNN-guided coord 2-opt swap.--copy_last base (anchor = last input stage, all cells within the manifest range;-coordinate point set and expression values kept, only the cell<->coordinate-pairing may be rearranged).--Mechanism (two stages):- A) global shift: v = pb(late) - pb(early) from the last two input stages- (pseudobulk over ALL cells of each stage); X_i <- clip(X_i + alpha*v, 0).- alpha is tiny (<=0.03) so the DE no-change protection still applies.- B) coord permutation: build the coordinate 15-NN graph (fixed; the point set- never moves); greedily swap the coordinates of cell pairs (i,j) when the- swap lowers the total expression cosine distance over the coord-15NN- edges (Dirichlet energy). Candidates come from the fast approximation- gain(i,j) ~ (x_j - x_i) . (N_i - N_j)- with N_i = sum of unit expression vectors of i's coord neighbours; each- candidate is re-checked with the exact energy delta before executing.- Swaps run best-first until the budget (SWAP% of cells) is reached, no- improving swap is found, or the time cap is hit.--VEC_ALPHA=0 and VEC_SWAP=0 skip both stages and reproduce copy_last-bit-for-bit (mechanism-off control). With a single input stage the shift is-skipped; the swap still runs on the anchor's own expression.+"""T2HX-06: deterministic rigid canonicalization of copy_last coordinates.++Base: anchor stage (last input at or before the target) copied out verbatim+-- expression matrix, row order, gene order untouched; only the coordinate+cloud may be rigidly re-oriented.++Mechanism (VEC_CANON=1):+ 1) subtract centroid,+ 2) PCA rotation with eigenvalues in decreasing order (principal axes),+ 3) flip last axis if det(R) < 0 (proper rotation, det = +1),+ 4) orient each axis by the sign of its third moment (make it positive);+ axes whose eigenvalue is near-degenerate with the next one+ (lam_{j+1}/lam_j > VEC_DEGEN, default 0.95) or whose third moment is+ numerically negligible keep the eigenvector sign as returned by eigh+ (deterministic for a given input).++The point set, all pairwise distances, the expression matrix and the+expression<->position pairing are unchanged; only the numeric coordinate+frame is rotated/translated.++VEC_CANON=0 (default) skips the canonicalization and reproduces copy_last+bit-for-bit (mechanism-off control). With a single input stage the base is+the same anchor stage; the mechanism needs no two-stage difference. """ from __future__ import annotations import argparse import os-import time import numpy as np from src.task2_spatial.sample import take from src.task2_spatial.view_io import ( anchor_entry,- extrap_step, load_manifest, panel_genes, read_stage, write_t2, ) -# Mechanism switches. Local A-half grid: alpha=0.02 shift ALONE breaks the DE-# no-change protection via clip(0) artefacts (de_score -0.125,-# expression_change 47.72) -> 49.10; adding the 2% coord swap gives 48.87-# (nb 0.11463->0.11459 negligible, occupancy_dice 0.8148->0.8131 hurt by the-# row reordering). PLAN stop-loss (first config <= 50) applies: defaults 0 =-# mechanism off = bit-for-bit copy_last.-ALPHA = float(os.environ.get("VEC_ALPHA", "0.0")) # 0 = shift off = copy_last X-SWAP = float(os.environ.get("VEC_SWAP", "0.0")) # % of cells to swap; 0 = off-EPS = float(os.environ.get("VEC_EPS", "0.002")) # min exact gain to accept a swap-ROUNDS = int(os.environ.get("VEC_ROUNDS", "3"))-KNN = int(os.environ.get("VEC_KNN", "15"))-TIME_CAP = float(os.environ.get("VEC_TIMECAP", "480"))-SEED_BATCH = 1024-TOP_CAND = 16+CANON = os.environ.get("VEC_CANON", "0") == "1"+DEGEN = float(os.environ.get("VEC_DEGEN", "0.95")) DEBUG = bool(os.environ.get("VEC_DEBUG")) -def coord_swap(X: np.ndarray, coords: np.ndarray, budget: int, seed: int) -> tuple[np.ndarray, dict]:- """Permute coords rows (cell<->coordinate pairing) to minimise expression- cosine distance over the coord-15NN graph. Returns (permuted coords, stats)."""- from scipy import sparse- from scipy.spatial import cKDTree-- n = X.shape[0]- rng = np.random.default_rng(seed + 12345)- tree = cKDTree(coords)- nbr = tree.query(coords, k=min(KNN, n - 1) + 1)[1][:, 1:]-- rows = np.repeat(np.arange(n), nbr.shape[1])- A = sparse.coo_matrix((np.ones(rows.size), (rows, nbr.ravel())), shape=(n, n))- U = (A + A.T).astype(bool).tocsr()- deg = np.diff(U.indptr)- maxdeg = int(deg.max())- Uadj = np.full((n, maxdeg), n, dtype=np.int64) # pad -> scratch zero row- for q in range(n):- Uadj[q, : deg[q]] = U.indices[U.indptr[q] : U.indptr[q + 1]]-- P = X.astype(np.float64)- P /= np.maximum(np.linalg.norm(P, axis=1, keepdims=True), 1e-12)- P = np.ascontiguousarray(np.vstack([P, np.zeros((1, P.shape[1]))])) # scratch row n- body = slice(0, n)-- def recompute() -> tuple[np.ndarray, np.ndarray, float]:- N = np.ascontiguousarray(P[Uadj].sum(axis=1))- d = np.einsum("ij,ij->i", P[body], N)- E = 0.5 * (float(deg.sum()) - float(d.sum()))- return N, d, E-- N, d, E0 = recompute()- stats = {"E0": E0, "E1": E0, "swaps": 0, "rounds": 0, "gain_total": 0.0, "budget": budget}- if budget <= 0:- return coords[np.arange(n)], stats-- budget = int(min(budget, n // 2))- perm = np.arange(n) # output row c gets coords[perm[c]]- swaps_done = 0- t0 = time.time()-- def exact_gain(a: int, b: int) -> float:- na = Uadj[a, : deg[a]]- nb = Uadj[b, : deg[b]]- na = na[na != b]- nb = nb[nb != a]- ua, ub = P[a], P[b]- Pa, Pb = P[na], P[nb]- return float(- (Pa @ ub).sum() + (Pb @ ua).sum() - (Pa @ ua).sum() - (Pb @ ub).sum()- )-- for rd in range(ROUNDS):- stats["rounds"] = rd + 1- if swaps_done >= budget or time.time() - t0 > TIME_CAP:- break- order = rng.permutation(n)- moved = np.zeros(n, dtype=bool)- for s in range(0, n, SEED_BATCH):- if swaps_done >= budget or time.time() - t0 > TIME_CAP:- break- I = order[s : s + SEED_BATCH]- I = I[~moved[I]]- if I.size == 0:- continue- Pb_ = P[body]- G = Pb_ @ N[I].T + N @ Pb_[I].T - d[:, None] - d[I][None, :]- G[I, :] = -np.inf- flat = G.ravel()- k = min(TOP_CAND, flat.size - 1)- top = np.argpartition(flat, -k)[-k:]- top = top[np.argsort(flat[top])[::-1]]- done = False- for f in top:- if flat[f] <= EPS:- break- a, t = divmod(int(f), I.size)- b = int(I[t])- g = exact_gain(a, b)- if g > EPS:- perm[[a, b]] = perm[[b, a]]- P[[a, b]] = P[[b, a]]- moved[a] = moved[b] = True- N, d, _ = recompute()- swaps_done += 1- stats["gain_total"] += g- if DEBUG and swaps_done % 50 == 0:- print(f"swap {swaps_done}: gain={g:.4f} t={time.time()-t0:.0f}s", flush=True)- done = True- break- if not done and flat.max() <= EPS:- pass # no promising pair in this batch- _, _, E1 = recompute()- stats["E1"] = E1- stats["swaps"] = swaps_done- return coords[perm], stats+def canonicalize(coords: np.ndarray) -> tuple[np.ndarray, dict]:+ C = np.asarray(coords, dtype=np.float64)+ info: dict = {"n": C.shape[0]}+ centroid = C.mean(axis=0)+ Z = C - centroid+ info["centroid"] = centroid.tolist()+ cov = (Z.T @ Z) / max(Z.shape[0] - 1, 1)+ lam, V = np.linalg.eigh(cov)+ order = np.argsort(lam)[::-1]+ lam = lam[order]+ V = V[:, order]+ if np.linalg.det(V) < 0:+ V = V.copy()+ V[:, -1] *= -1.0+ info["eigenvalues"] = lam.tolist()+ info["det_R"] = float(np.linalg.det(V))+ Zr = Z @ V+ rms = float(np.sqrt((Zr**2).sum(axis=1).mean()))+ info["rms"] = rms+ m3 = (Zr**3).mean(axis=0)+ info["third_moment_pre"] = m3.tolist()+ flips = []+ skipped = []+ for j in range(Zr.shape[1]):+ near_degen = j + 1 < len(lam) and lam[j] > 0 and (lam[j + 1] / lam[j]) > DEGEN+ negligible = abs(m3[j]) < 1e-9 * rms**3+ if near_degen or negligible:+ skipped.append(j)+ elif m3[j] < 0:+ flips.append(j)+ # keep the total transform a proper rotation (det = +1): the third-moment+ # orientation must not mirror the cloud (biologically wrong, and mirroring+ # to exploit the scorer's det=+1-only flip search is gaming). If the flip+ # count is odd, undo the flip on the axis with the smallest |m3|.+ undo = None+ if len(flips) % 2 == 1:+ undo = min(flips, key=lambda j: abs(m3[j]))+ flips = [j for j in flips if j != undo]+ info["undo_axis"] = undo+ info["skipped_axes"] = skipped+ for j in flips:+ Zr[:, j] *= -1.0+ info["flipped_axes"] = flips+ info["third_moment_post"] = (Zr**3).mean(axis=0).tolist()+ info["det_total"] = float(np.linalg.det(V) * ((-1.0) ** len(flips)))+ return Zr, info def main() -> None:@@ -176,38 +112,19 @@ def main() -> None: X = stage.X[rows].toarray().astype(np.float32) coords = stage.coords[rows] - # ---- stage A: global micro shift ----- if ALPHA != 0.0:- prev_entry, _, _ = extrap_step(manifest)- if prev_entry is not None:- prev = read_stage(args.data, prev_entry, genes)- pb_early = np.asarray(prev.X.mean(axis=0)).ravel().astype(np.float64)- pb_late = np.asarray(stage.X.mean(axis=0)).ravel().astype(np.float64)- v = pb_late - pb_early- X0 = X.mean(axis=0).astype(np.float64)- Xs = X.astype(np.float64) + ALPHA * v[None, :]- X = np.clip(Xs, 0.0, None).astype(np.float32)- if DEBUG:- dp = X.mean(axis=0).astype(np.float64) - X0- print(- f"alpha={ALPHA} std(v)={v.std():.4f} std(dp)={dp.std():.5f} "- f"max|dp|={np.abs(dp).max():.4f} n_clip={int((Xs < 0).sum())}",- flush=True,- )- elif DEBUG:- print("single input stage: shift skipped", flush=True)-- # ---- stage B: coord permutation ----- if SWAP > 0.0:- budget = int(round(SWAP / 100.0 * X.shape[0]))- coords, st = coord_swap(X, coords, budget, args.seed)+ if CANON:+ coords, info = canonicalize(coords) if DEBUG:- drop = st["E0"] - st["E1"] print(- f"swaps={st['swaps']}/{st['budget']} rounds={st['rounds']} "- f"E0={st['E0']:.1f} E1={st['E1']:.1f} drop={drop:.2f} ({100*drop/max(st['E0'],1e-9):.3f}%)",+ "canon: centroid={centroid} eig={eigenvalues} det_R={det_R:.6f} "+ "rms={rms:.4f} m3_pre={third_moment_pre} m3_post={third_moment_post} "+ "flips={flipped_axes} skipped={skipped_axes} det_total={det_total:.6f}".format(+ **{k: info.get(k) for k in info}+ ), flush=True, )+ elif DEBUG:+ print("canon OFF: bit-for-bit copy_last", flush=True) write_t2(args.out, X, coords, genes, seed=args.seed)
调研来源?调研员查到并用到的知识条目和文献检索结果(只列标题和编号)。
用到的知识库条目
| 编号 | 标题 | 出处 |
|---|---|---|
| k007 | Interval staging and held-out-window filtering of external data | notes/official/来件/virtualembryo.ai/rules.md |
| k016 | Degenerate-solution checks for population predictions | notes/handover/02_知识学习路线.md |
| k026 | Canonicalise predicted 3D coordinates before submission | notes/pitfalls/04_scorer_invariance.md |
分析结果?分析员写的 ANALYSIS.json:改了什么、各组分数怎么变、假设是否成立、经验和下一步建议。
| 改了什么 | 在 copy_last 基座上新增 VEC_CANON 开关的刚体坐标规范化(质心归零→PCA 主轴降序→det=+1 修正→第三矩定向,含 det=+1 守卫否决镜像),表达矩阵与行序不动;on 态实测 50.00 未过 PLAN 的 >50.5 门槛,按规则以机制关(逐位=copy_last)提交。 |
|---|---|
| 各组分数的变化 | cell_state:不变:50.00→50.00,mmd_u 0.05832、variogram 0.05806 与父节点逐位相同(刚体变换不碰表达),skill 0.500。 expression_change:不变:50.00→50.00,de_score/de_direction 原始值均为 0(地板保护),skill 0.500。 local_spatial:不变:50.00→50.00,neighborhood_mmd 0.1126 逐位相同,skill 0.500。 shape_scale:不变:50.00→50.00。on 态原始值有微小漂移(occupancy_dice 0.8066→0.8148、d2_shape 0.04911→0.04891、scale_log_ratio −0.4334→−0.4375),但三项 skill 仍=0.500,得分变化在噪声内(实为 0)。 |
| family_id | T2HX-06 |
| 假设是否成立 | 否 |
| 经验 |
|
| mechanism_active | 否 |
| 下一步建议 |
|
对话摘要?每个角色和大模型对话的统计:轮数、工具调用、用时、token 数和最后的回答摘录;原始记录只给路径。
只给统计和最后回答的摘录;完整对话请到原始记录位置里列出的文件看。
分析员
| 角色?调研员写计划、工程师改代码、分析员解读分数、审查员检查作弊。 | 分析员 alibaba-token-plan-cn/qwen3.8-max |
|---|---|
| 调用次数 | 1 次 |
| 轮数?大模型一共回复了几轮(每轮可以调用多个工具)。 | 3 |
| 工具调用?大模型调用读文件、执行命令等工具的次数,按工具名统计。 | 共 2 次:bash 1、write 1 |
| 用时 | 不到 1 分 |
| token 数?输入 / 输出(含思考)的 token 数,来自接口返回的用量。 | 输入 16,627 · 输出 1,120 · 思考 439 |
| 任务(第一行) | 分析节点 n17 的打分结果,写 ANALYSIS.json |
| 最后的回答(摘录) | ANALYSIS.json written |
| 原始记录位置?完整对话记录在 Spark 上的文件路径;看板不复制原始内容。 | /home/spark-longxinyang/vec/runs/formal/20261003-105537-search-t2-heart-extrap-g24-D/nodes/17/analyst.jsonl 7 KB /home/spark-longxinyang/vec/runs/formal/20261003-105537-search-t2-heart-extrap-g24-D/nodes/17/analyst.stderr |
工程师
| 角色 | 工程师 alibaba-token-plan-cn/qwen3.8-max |
|---|---|
| 调用次数 | 1 次 |
| 轮数 | 17 |
| 工具调用 | 共 17 次:bash 13、write 2、edit 2 |
| 用时 | 8 分 |
| token 数 | 输入 46,007 · 输出 6,058 · 思考 6,688 |
| 任务(第一行) | 按计划修改程序:T2HX-06 坐标规范化:PCA主轴+手性固定消除形状评分方向方差 |
| 最后的回答(摘录) | Done. Final state verified: default `run.py` (no env) = bit-for-bit copy_last (sha `a26c0b78…`, matches parent), passes `vec-check`; canon code behind `VEC_CANON` switch as control. **Summary** - Implemented PLAN T2HX-06: deterministic rigid canonicalization of copy_last coords (centroid→PCA axes→det=+1→third-moment orientation), with a det=+1 guard that vetoes any mirroring (biologically wrong + scorer mirror-blindspot gaming is forbidden). - Mechanism evidence: eigenvalues [18720, 16467, 11850], no degeneracy, det_R=+1; the single m3<0 axis flip was vetoed by the guard, so on-state is a pure PCA rotation. - Queries used: 1/20. canon-on scored **50.00** on proxy_noscale A-half (all 8 skills = floor 0.5; expression/cell_state raws bit-identical to off; occupancy 0.8066→0.8148 raw drift but same skill). Off-state = parent's copy_last file, 50.00 established (σ=0), not re-queried. - PLAN rule (>50.5 → submit canon) not met → submitted mechanism-off (= copy_last, score 50.00). Hypothesis falsified: the scorer's occupancy_dice already does centroid+PCA+4 det=+1 flips, so any proper-rotation pre-canonicalization is score-wise identity. - Next best direction: this board's in-view perturbation families (T2HX-01/02/03/04/06) are now exhaustively falsified on copy_last; only cross-stage pairing with external time-direction info (with std(dp)<1%·std(dt) hard gate) remains, or reallocate budget to the interpolation boards where local gains transfer to official scores. |
| 原始记录位置 | /home/spark-longxinyang/vec/runs/formal/20261003-105537-search-t2-heart-extrap-g24-D/nodes/17/engineer.jsonl 95 KB /home/spark-longxinyang/vec/runs/formal/20261003-105537-search-t2-heart-extrap-g24-D/nodes/17/engineer.stderr |
调研员
| 角色 | 调研员 alibaba-token-plan-cn/qwen3.8-max |
|---|---|
| 调用次数 | 1 次 |
| 轮数 | 1 |
| 工具调用 | 共 0 次:— |
| 用时 | 3 分 |
| token 数 | 输入 17,359 · 输出 998 · 思考 8,050 |
| 任务(第一行) | 为节点 n17(改进,父节点 n13)写改进计划 PLAN.json |
| 最后的回答(摘录) | oordinate permutation). Parent node 13 is at floor 50.00 with all micro-perturbation families exhausted. The ANALYSIS explicitly closes view-internal perturbation and suggests either external information or T2HX-06. The direction library marks T2HX-06 as "本榜最需要" (most needed on this board), and literature note k026 documents that the shape metric's PCA alignment doesn't fix handedness, causing >noise score variance from rigid rotations. This hasn't been tried in the tree.
```json
{"name": "T2HX-06 坐标规范化:PCA主轴+手性固定消除形状评分方向方差",
"motivation": "父节点13及全树17个节点中,除node5(52.74,未复现)外全部停在地板50.00。ANALYSIS明确关闭视图内微扰族。方向库标注T2HX-06为'本榜最需要'且从未被尝试。文献k026记录:形状指标PCA对齐不固定行列式,同一预测的刚体旋转可使形状分变化超过噪声(>1分)。当前copy_last输出的坐标方向是原始数据给定的任意方向,可能不在评分器4种det=+1翻转能覆盖的最优对齐上。",
"approach": "步骤:(1) 从anchor_entry读末输入阶段,输出copy_last(X、坐标、行序不变);(2) 对坐标做规范化:减质心→PCA旋转(按特征值降序排列主轴)→强制det=+1(若det<0则翻转最后一轴)→按各轴第三矩符号定向(使第三矩为正);(3) 表达矩阵、行序、基因序完全不动;(4) vec-score查分,若榜分>50.5则提交规范化版,否则提交未规范化版(=copy_last)。关键参数:无搜索参数,规范化是确定性流程。单输入阶段退路:只有一个阶段时仍可做规范化(只需坐标,不需两阶段差分)。若PCA特征值近简并(λ2/λ3>0.95),跳过该轴定向以避免不稳定。用vec-score一次查分即可判定(噪声~1分,>50.5才有意义)。",
"expected_groups": ["shape_scale"],
"risks": "1) 评分器occupancy_dice已做4种翻转取最优,规范化可能无额外收益(发现方式:查分后形状组无变化);2) PCA近简并导致主轴不稳定,规范化引入随机性(发现方式:两次运行输出不同,加特征值比检查);3) 规范化后行序不变但坐标值变,理论上不影响occupancy_dice抽样(它按细胞数抽,不按行序),但需确认。Engineer应在实现后先打印特征值比和det,确认规范化稳定。",
"family_id": "T2HX-06",
"mechanism": "对坐标做确定性刚体规范化(质心归零→PCA主轴对齐→行列式修正→第三矩定向),消除输入数据任意方向带来的形状评分方差,不改变点云形状、表达值或细胞配对。",
"vs_constant_shift": "不涉及任何表达值修改(常数位移改X矩阵);不改变细胞组成或坐标点集的内在几何(全局重加权改组成);仅做刚体旋转使坐标呈现确定性方向,所有点对距离、邻域关系、表达-位置配对完全不变。",
"mechanism_evidence": "Engineer打印:(1)规范化前后的坐标质心、PCA特征值、旋转矩阵det;(2)d2_shape原始值(应逐位不变,验证刚体不变性);(3)occupancy_dice原始值变化(这是唯一可能受影响的指标);(4)四组分对比确认expression_change和cell_state不变。若occupancy_dice变化>0.005且方向一致(多次查分),说明方向确实影响评分。",
"mechanism_off_control": "环境变量VEC_CANON=0(默认)时跳过规范化步骤,输出与copy_last逐位一致。预期:off态榜分=50.00(地板);on态若机制有效则occupancy_dice改善→shape_scale>50,否则=50.00。两态表达矩阵和坐标点集(作为点集)完全相同,仅坐标数值因旋转不同。",
"sources": []}
``` |
| 原始记录位置 | /home/spark-longxinyang/vec/runs/formal/20261003-105537-search-t2-heart-extrap-g24-D/nodes/17/researcher.jsonl 5 KB /home/spark-longxinyang/vec/runs/formal/20261003-105537-search-t2-heart-extrap-g24-D/nodes/17/researcher.stderr |