Spaces:
Sleeping
Sleeping
CarolinePascal commited on
chore(format): formatting code
Browse filesFiles changed (2)
1670 unmodified lines16711672167316741675167616772 unmodified lines168016811682168316841685168672 unmodified lines175917601761176217631764176574 unmodified lines18401841184218431844184518461670 unmodified linesif (v > hi) hi = v;}}motorRanges[d] = (hi - lo) || 1;}// Per-episode, per-dimension activity: p95(|Δa|) >= 1% of motor range2 unmodified linesconst activeMap: boolean[][] = episodeActions.map(({ actions: ep }) => {const flags: boolean[] = new Array(actionDim);for (let d = 0; d < actionDim; d++) {if (ep.length < 2) { flags[d] = false; continue; }const absDeltas: number[] = [];for (let t = 1; t < ep.length; t++) {absDeltas.push(Math.abs((ep[t][d] ?? 0) - (ep[t - 1][d] ?? 0)));72 unmodified linesif (b >= binCount) b = binCount - 1;bins[b]++;}results.push({ name: shortName(actionNames[d]), std, maxAbs, bins, lo, hi, motorRange, inactive });}return results;})();74 unmodified linesfor (let t = 1; t < ep.length; t++) {for (let d = 0; d < actionDim; d++) {if (!activeMap[ei][d]) continue; // skip motors inactive in this episodesum += Math.abs((ep[t][d] ?? 0) - (ep[t - 1][d] ?? 0)) / motorRanges[d];count++;}}1670 unmodified lines16711672167316741675167616772 unmodified lines168016811682168316841685168616871688168972 unmodified lines176217631764176517661767176817691770177117721773177417751776177774 unmodified lines185218531854185518561857185818591670 unmodified linesif (v > hi) hi = v;}}motorRanges[d] = hi - lo || 1;}// Per-episode, per-dimension activity: p95(|Δa|) >= 1% of motor range2 unmodified linesconst activeMap: boolean[][] = episodeActions.map(({ actions: ep }) => {const flags: boolean[] = new Array(actionDim);for (let d = 0; d < actionDim; d++) {if (ep.length < 2) {flags[d] = false;continue;}const absDeltas: number[] = [];for (let t = 1; t < ep.length; t++) {absDeltas.push(Math.abs((ep[t][d] ?? 0) - (ep[t - 1][d] ?? 0)));72 unmodified linesif (b >= binCount) b = binCount - 1;bins[b]++;}results.push({name: shortName(actionNames[d]),std,maxAbs,bins,lo,hi,motorRange,inactive,});}return results;})();74 unmodified linesfor (let t = 1; t < ep.length; t++) {for (let d = 0; d < actionDim; d++) {if (!activeMap[ei][d]) continue; // skip motors inactive in this episodesum +=Math.abs((ep[t][d] ?? 0) - (ep[t - 1][d] ?? 0)) / motorRanges[d];count++;}}
350 unmodified lines35135235335435535635735837 unmodified lines39639739839940040140268 unmodified lines47147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251352 unmodified lines56656756856957057157243 unmodified lines61661761861962062162262324 unmodified lines648649650651652653654226 unmodified lines881882883884885886887888889453 unmodified lines134313441345134613471348134913501351135240 unmodified lines1393139413951396139713981399350 unmodified lines<br /><span className="text-slate-500">Grounded in the theoretical result that chunk length shouldscale logarithmically with system stability constants (<a href="https://arxiv.org/abs/2507.09061" target="_blank" rel="noopener noreferrer" className="underline hover:text-slate-300">Zhang etal., 2025</a>, Theorem 1).</span></p></InfoToggle>37 unmodified linesfontSize: 13,}}/><YAxis stroke="#94a3b8" domain={yDomain} tickFormatter={(v) => Number(v.toFixed(2)).toString()} /><TooltipcontentStyle={{background: "#1e293b",68 unmodified linesif (actionKeys.length === 0 || data.length < 2) return [];const ACTIVITY_THRESHOLD = 0.001; // 0.1% of motor rangereturn actionKeys.map((key) => {const values = data.map((row) => row[key] ?? 0);const motorMin = Math.min(...values);const motorMax = Math.max(...values);const motorRange = (motorMax - motorMin) || 1;const deltas = values.slice(1).map((v, i) => v - values[i]);if (deltas.length === 0)return { name: shortName(key), std: 0, maxAbs: 0, bins: new Array(30).fill(0), lo: 0, hi: 0, motorRange };// Activity score: p95 of |Δa|const absDeltas = deltas.map(Math.abs).sort((a, b) => a - b);const p95 = absDeltas[Math.floor(absDeltas.length * 0.95)];const inactive = p95 < motorRange * ACTIVITY_THRESHOLD;const mean = deltas.reduce((a, b) => a + b, 0) / deltas.length;const rawStd = Math.sqrt(deltas.reduce((a, d) => a + (d - mean) ** 2, 0) / deltas.length,);const std = rawStd / motorRange;const maxAbsRaw = Math.max(...absDeltas);const maxAbs = maxAbsRaw / motorRange;const binCount = 30;const lo = Math.min(...deltas) / motorRange;const hi = Math.max(...deltas) / motorRange;const range = hi - lo || 1;const binW = range / binCount;const bins: number[] = new Array(binCount).fill(0);for (const d of deltas) {const normD = d / motorRange;let b = Math.floor((normD - lo) / binW);if (b >= binCount) b = binCount - 1;bins[b]++;}return { name: shortName(key), std, maxAbs, bins, lo, hi, motorRange, inactive };});}, [data, actionKeys, agg]);const stats = useMemo(52 unmodified lines);if (inactiveCount > 0)lines.push(`${inactiveCount} inactive (${stats.filter((s) => s.inactive).map((s) => s.name).join(", ")}) — excluded from computation`,);let tip: string;43 unmodified lines<br /><span className="text-slate-500">Relates to the Lipschitz constant L<sub>π</sub> and smoothness C<sub>π</sub> in <a href="https://arxiv.org/abs/2507.09061" target="_blank" rel="noopener noreferrer" className="underline hover:text-slate-300">Zhang et al. (2025)</a>, which govern compoundingerror bounds (Assumptions 3.1, 4.1).</span></p></InfoToggle>24 unmodified lines</span>)}</p><div className={`flex gap-2 text-xs tabular-nums ${dimmed ? "text-slate-600" : "text-slate-400"}`}><span>σ={s.std.toFixed(4)}</span><span>|Δ|<sub>max</sub>={s.maxAbs.toFixed(4)}226 unmodified linesindicate consistent behavior across demonstrations.<br /><span className="text-slate-500">Relates to the "coverage" discussion in <a href="https://arxiv.org/abs/2507.09061" target="_blank" rel="noopener noreferrer" className="underline hover:text-slate-300">Zhang et al.(2025)</a> — regions with low variance may lack the exploratorycoverage needed to prevent compounding errors (Section 4).</span></p></InfoToggle>453 unmodified linescommanded and when the corresponding state changes.<br /><span className="text-slate-500">Central to ACT (<a href="https://arxiv.org/abs/2304.13705" target="_blank" rel="noopener noreferrer" className="underline hover:text-slate-300">Zhao et al., 2023</a> — action chunking compensatesfor delay), Real-Time Chunking (RTC, <a href="https://arxiv.org/abs/2506.07339" target="_blank" rel="noopener noreferrer" className="underline hover:text-slate-300">Black et al., 2025</a>), and Training-TimeRTC (<a href="https://arxiv.org/abs/2512.05964" target="_blank" rel="noopener noreferrer" className="underline hover:text-slate-300">Black et al., 2025</a>) — all address the timing mismatchbetween commanded actions and observed state changes.</span></p></InfoToggle>40 unmodified linesfontSize: 13,}}/><YAxis stroke="#94a3b8" domain={[-0.5, 1]} tickFormatter={(v) => Number(v.toFixed(2)).toString()} /><TooltipcontentStyle={{background: "#1e293b",350 unmodified lines35135235335435535635735835936036136236336436536637 unmodified lines40440540640740840941041141241341468 unmodified lines48348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054152 unmodified lines59459559659759859960060160260343 unmodified lines64764864965065165265365465565665765865966066166224 unmodified lines687688689690691692693694695226 unmodified lines922923924925926927928929930931932933934935936937938453 unmodified lines13921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142740 unmodified lines14681469147014711472147314741475147614771478350 unmodified lines<br /><span className="text-slate-500">Grounded in the theoretical result that chunk length shouldscale logarithmically with system stability constants (<ahref="https://arxiv.org/abs/2507.09061"target="_blank"rel="noopener noreferrer"className="underline hover:text-slate-300">Zhang et al., 2025</a>, Theorem 1).</span></p></InfoToggle>37 unmodified linesfontSize: 13,}}/><YAxisstroke="#94a3b8"domain={yDomain}tickFormatter={(v) => Number(v.toFixed(2)).toString()}/><TooltipcontentStyle={{background: "#1e293b",68 unmodified linesif (actionKeys.length === 0 || data.length < 2) return [];const ACTIVITY_THRESHOLD = 0.001; // 0.1% of motor rangereturn actionKeys.map((key) => {const values = data.map((row) => row[key] ?? 0);const motorMin = Math.min(...values);const motorMax = Math.max(...values);const motorRange = motorMax - motorMin || 1;const deltas = values.slice(1).map((v, i) => v - values[i]);if (deltas.length === 0)return {name: shortName(key),std: 0,maxAbs: 0,bins: new Array(30).fill(0),lo: 0,hi: 0,motorRange,};// Activity score: p95 of |Δa|const absDeltas = deltas.map(Math.abs).sort((a, b) => a - b);const p95 = absDeltas[Math.floor(absDeltas.length * 0.95)];const inactive = p95 < motorRange * ACTIVITY_THRESHOLD;const mean = deltas.reduce((a, b) => a + b, 0) / deltas.length;const rawStd = Math.sqrt(deltas.reduce((a, d) => a + (d - mean) ** 2, 0) / deltas.length,);const std = rawStd / motorRange;const maxAbsRaw = Math.max(...absDeltas);const maxAbs = maxAbsRaw / motorRange;const binCount = 30;const lo = Math.min(...deltas) / motorRange;const hi = Math.max(...deltas) / motorRange;const range = hi - lo || 1;const binW = range / binCount;const bins: number[] = new Array(binCount).fill(0);for (const d of deltas) {const normD = d / motorRange;let b = Math.floor((normD - lo) / binW);if (b >= binCount) b = binCount - 1;bins[b]++;}return {name: shortName(key),std,maxAbs,bins,lo,hi,motorRange,inactive,};});}, [data, actionKeys, agg]);const stats = useMemo(52 unmodified lines);if (inactiveCount > 0)lines.push(`${inactiveCount} inactive (${stats.filter((s) => s.inactive).map((s) => s.name).join(", ")}) — excluded from computation`,);let tip: string;43 unmodified lines<br /><span className="text-slate-500">Relates to the Lipschitz constant L<sub>π</sub> and smoothness C<sub>π</sub> in{" "}<ahref="https://arxiv.org/abs/2507.09061"target="_blank"rel="noopener noreferrer"className="underline hover:text-slate-300">Zhang et al. (2025)</a>, which govern compounding error bounds (Assumptions 3.1, 4.1).</span></p></InfoToggle>24 unmodified lines</span>)}</p><divclassName={`flex gap-2 text-xs tabular-nums ${dimmed ? "text-slate-600" : "text-slate-400"}`}><span>σ={s.std.toFixed(4)}</span><span>|Δ|<sub>max</sub>={s.maxAbs.toFixed(4)}226 unmodified linesindicate consistent behavior across demonstrations.<br /><span className="text-slate-500">Relates to the "coverage" discussion in{" "}<ahref="https://arxiv.org/abs/2507.09061"target="_blank"rel="noopener noreferrer"className="underline hover:text-slate-300">Zhang et al. (2025)</a>{" "}— regions with low variance may lack the exploratory coverageneeded to prevent compounding errors (Section 4).</span></p></InfoToggle>453 unmodified linescommanded and when the corresponding state changes.<br /><span className="text-slate-500">Central to ACT (<ahref="https://arxiv.org/abs/2304.13705"target="_blank"rel="noopener noreferrer"className="underline hover:text-slate-300">Zhao et al., 2023</a>{" "}— action chunking compensates for delay), Real-Time Chunking(RTC,{" "}<ahref="https://arxiv.org/abs/2506.07339"target="_blank"rel="noopener noreferrer"className="underline hover:text-slate-300">Black et al., 2025</a>), and Training-Time RTC (<ahref="https://arxiv.org/abs/2512.05964"target="_blank"rel="noopener noreferrer"className="underline hover:text-slate-300">Black et al., 2025</a>) — all address the timing mismatch between commanded actionsand observed state changes.</span></p></InfoToggle>40 unmodified linesfontSize: 13,}}/><YAxisstroke="#94a3b8"domain={[-0.5, 1]}tickFormatter={(v) => Number(v.toFixed(2)).toString()}/><TooltipcontentStyle={{background: "#1e293b",
src/app/[org]/[dataset]/[episode]/fetch-data.ts+17-4
src/components/action-insights-panel.tsx+131-52