fix(consolidate): eps 1.0->0.4 修复 DBSCAN 聚类失效 (clusters=1->34)

根因: bge-m3 向量已归一化(norm=1.0, 距离 p50=0.42-0.75), 旧 eps=1.0 按未归一化数据(p50=1.029)调试,
在归一化空间过大 -> 全部连成1簇 -> consolidate 空转多日 (clusters=1 error 每15min刷)

实测: eps=0.4 -> clusters=34 noise=1030, 能发现重复状态噪音簇(1045条主profile状态同步/961条CBM状态)
This commit is contained in:
xiaowei
2026-09-05 18:13:53 +08:00
parent ad4e9b7bef
commit 1416b4e41f
+7 -3
View File
@@ -74,9 +74,13 @@ func Run(dataDir, sqlitePath, mode string) (*Result, error) {
LLMEndpoint: os.Getenv("LLM_ENDPOINT"),
LLMModel: os.Getenv("LLM_MODEL"),
LLMApiKey: os.Getenv("LLM_API_KEY"),
Epsilon: 1.0,
// 距离分布: p50=1.029, p95=1.135, max=1.184
// eps=0.1 → 1435 noise (太严), eps=1.0 → 合理语义聚类, eps=1.5 → 1个巨大cluster
Epsilon: 0.4,
// 距离分布(2026-09-05 实测,bge-m3 归一化向量 norm=1.0):
// 全量3000抽样: p25=0.24 p50=0.75 p95=0.82
// sidecar 零向量 top-10000 样本: p5=0.09 p50=0.42 p95=1.0
// eps=1.0(旧值,按未归一化 p50=1.029 调的)→ 归一化空间过大 → clusters=1 聚类失效
// eps=0.3~0.5 → 有语义簇(能发现重复状态噪音簇: 1045条"主profile状态同步"/961条"CBM状态")
// eps=0.4 = 平衡(2026-09-05 修复,commit 待推)
MinPoints: 3,
ModelDir: os.Getenv("BGE_MODEL_DIR"),
})