ml/gen: 确定性老师(碰撞次数计时 + resetSession)、pos 任务冻结 J6、--consensus 邻域共识过滤、Dr 类、README(高性能机器运行说明)
This commit is contained in:
@@ -8,6 +8,8 @@ const N = +process.argv[2] || 100, SEED = +process.argv[3] || 4242;
|
||||
const { S, ArmIK } = require('../../tests/route_bench_setup.cjs')();
|
||||
const sm = require('./sampler.cjs')(S, SEED);
|
||||
const teach = require('./teacher.cjs')(S, ArmIK);
|
||||
const PD = require('./pathdev.cjs');
|
||||
const fz = (r, t) => (t.mode === 'pos' && r.ptsJ6Frozen) ? r.ptsJ6Frozen : r.pts; // 与 gen 同口径:pos 任务冻结 J6(gen 里认证不过才回退)
|
||||
const { VMAX } = require('./timelaw.cjs');
|
||||
function resample(P, n) {
|
||||
const seg = []; for (let i = 1; i < P.length; i++) { let m = 0; for (let j = 0; j < 6; j++) m = Math.max(m, Math.abs(P[i][j] - P[i - 1][j]) / VMAX[j]); seg.push(m); }
|
||||
@@ -22,16 +24,16 @@ const axisHist = [0, 0, 0, 0, 0, 0]; let sameNoJ6 = 0;
|
||||
let tasks = 0, pairs = 0, same = 0, detSame = 0, detN = 0; const devs = [], byCat = {};
|
||||
while (tasks < N) {
|
||||
const t = sm.sample(); if (t.cat !== 'B' && t.cat !== 'C') continue;
|
||||
const base = teach(t); if (!base.ok || !base.reached) continue;
|
||||
const base = teach(t); if (!base.ok || !base.reached) continue; base.pts = fz(base, t);
|
||||
tasks++;
|
||||
const again = teach(t); if (again.ok) { detN++; if (dev(base.pts, again.pts) < 1e-6) detSame++; }
|
||||
const again = teach(t); if (again.ok) { detN++; if (dev(base.pts, fz(again, t)) < 1e-6) detSame++; }
|
||||
for (let k = 0; k < 4; k++) {
|
||||
const u = [sm.rnd() - 0.5, sm.rnd() - 0.5, sm.rnd() - 0.5], n = Math.hypot(...u);
|
||||
const T2 = t.T.map((v, i) => v + 5 * u[i] / n);
|
||||
const r = teach(Object.assign({}, t, { T: T2 }));
|
||||
if (!r.ok || !r.reached) continue;
|
||||
const da = devAx(base.pts, r.pts), d = Math.max(...da); devs.push(d); pairs++;
|
||||
if (Math.max(...da.slice(0, 5)) < 30) sameNoJ6++;
|
||||
const da = devAx(base.pts, fz(r, t)), d = Math.max(...da); devs.push(d); pairs++;
|
||||
if (PD.sameClass(base.pts, fz(r, t), t.mode)) sameNoJ6++;
|
||||
if (d >= 30) axisHist[da.indexOf(d)]++;
|
||||
const c = byCat[t.cat] = byCat[t.cat] || { pairs: 0, same: 0 }; c.pairs++;
|
||||
if (d < 30) { same++; c.same++; }
|
||||
@@ -42,4 +44,4 @@ devs.sort((a, b) => a - b);
|
||||
console.log(JSON.stringify({ tasks, pairs, consistentRate: +(same / pairs).toFixed(3), gate: same / pairs >= 0.9 ? 'PASS' : 'FAIL',
|
||||
devP50: +devs[devs.length >> 1].toFixed(1), devP90: +devs[Math.floor(devs.length * 0.9)].toFixed(1),
|
||||
byCat: Object.fromEntries(Object.entries(byCat).map(([k, v]) => [k, +(v.same / v.pairs).toFixed(3)])),
|
||||
consistentIgnoringJ6: +(sameNoJ6 / pairs).toFixed(3), worstAxisOfInconsistent: axisHist, deterministic: detSame + '/' + detN }));
|
||||
consistentByGateRule: +(sameNoJ6 / pairs).toFixed(3), gateByRule: sameNoJ6 / pairs >= 0.9 ? 'PASS' : 'FAIL', worstAxisOfInconsistent: axisHist, deterministic: detSame + '/' + detN }));
|
||||
|
||||
Reference in New Issue
Block a user