CarolinePascal commited on
Commit
3f3a086
·
unverified ·
1 Parent(s): b3b1c86

chore(format): formatting code

Browse files
src/app/[org]/[dataset]/[episode]/fetch-data.ts CHANGED
@@ -1671,7 +1671,7 @@ export async function loadCrossEpisodeActionVariance(
1671
  if (v > hi) hi = v;
1672
  }
1673
  }
1674
- motorRanges[d] = (hi - lo) || 1;
1675
  }
1676
 
1677
  // Per-episode, per-dimension activity: p95(|Δa|) >= 1% of motor range
@@ -1680,7 +1680,10 @@ export async function loadCrossEpisodeActionVariance(
1680
  const activeMap: boolean[][] = episodeActions.map(({ actions: ep }) => {
1681
  const flags: boolean[] = new Array(actionDim);
1682
  for (let d = 0; d < actionDim; d++) {
1683
- if (ep.length < 2) { flags[d] = false; continue; }
 
 
 
1684
  const absDeltas: number[] = [];
1685
  for (let t = 1; t < ep.length; t++) {
1686
  absDeltas.push(Math.abs((ep[t][d] ?? 0) - (ep[t - 1][d] ?? 0)));
@@ -1759,7 +1762,16 @@ export async function loadCrossEpisodeActionVariance(
1759
  if (b >= binCount) b = binCount - 1;
1760
  bins[b]++;
1761
  }
1762
- results.push({ name: shortName(actionNames[d]), std, maxAbs, bins, lo, hi, motorRange, inactive });
 
 
 
 
 
 
 
 
 
1763
  }
1764
  return results;
1765
  })();
@@ -1840,7 +1852,8 @@ export async function loadCrossEpisodeActionVariance(
1840
  for (let t = 1; t < ep.length; t++) {
1841
  for (let d = 0; d < actionDim; d++) {
1842
  if (!activeMap[ei][d]) continue; // skip motors inactive in this episode
1843
- sum += Math.abs((ep[t][d] ?? 0) - (ep[t - 1][d] ?? 0)) / motorRanges[d];
 
1844
  count++;
1845
  }
1846
  }
 
1671
  if (v > hi) hi = v;
1672
  }
1673
  }
1674
+ motorRanges[d] = hi - lo || 1;
1675
  }
1676
 
1677
  // Per-episode, per-dimension activity: p95(|Δa|) >= 1% of motor range
 
1680
  const activeMap: boolean[][] = episodeActions.map(({ actions: ep }) => {
1681
  const flags: boolean[] = new Array(actionDim);
1682
  for (let d = 0; d < actionDim; d++) {
1683
+ if (ep.length < 2) {
1684
+ flags[d] = false;
1685
+ continue;
1686
+ }
1687
  const absDeltas: number[] = [];
1688
  for (let t = 1; t < ep.length; t++) {
1689
  absDeltas.push(Math.abs((ep[t][d] ?? 0) - (ep[t - 1][d] ?? 0)));
 
1762
  if (b >= binCount) b = binCount - 1;
1763
  bins[b]++;
1764
  }
1765
+ results.push({
1766
+ name: shortName(actionNames[d]),
1767
+ std,
1768
+ maxAbs,
1769
+ bins,
1770
+ lo,
1771
+ hi,
1772
+ motorRange,
1773
+ inactive,
1774
+ });
1775
  }
1776
  return results;
1777
  })();
 
1852
  for (let t = 1; t < ep.length; t++) {
1853
  for (let d = 0; d < actionDim; d++) {
1854
  if (!activeMap[ei][d]) continue; // skip motors inactive in this episode
1855
+ sum +=
1856
+ Math.abs((ep[t][d] ?? 0) - (ep[t - 1][d] ?? 0)) / motorRanges[d];
1857
  count++;
1858
  }
1859
  }
src/components/action-insights-panel.tsx CHANGED
@@ -351,8 +351,16 @@ function AutocorrelationSection({
351
  <br />
352
  <span className="text-slate-500">
353
  Grounded in the theoretical result that chunk length should
354
- scale 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 et
355
- al., 2025</a>, Theorem 1).
 
 
 
 
 
 
 
 
356
  </span>
357
  </p>
358
  </InfoToggle>
@@ -396,7 +404,11 @@ function AutocorrelationSection({
396
  fontSize: 13,
397
  }}
398
  />
399
- <YAxis stroke="#94a3b8" domain={yDomain} tickFormatter={(v) => Number(v.toFixed(2)).toString()} />
 
 
 
 
400
  <Tooltip
401
  contentStyle={{
402
  background: "#1e293b",
@@ -471,43 +483,59 @@ function ActionVelocitySection({
471
  if (actionKeys.length === 0 || data.length < 2) return [];
472
 
473
  const ACTIVITY_THRESHOLD = 0.001; // 0.1% of motor range
474
- return actionKeys
475
- .map((key) => {
476
- const values = data.map((row) => row[key] ?? 0);
477
- const motorMin = Math.min(...values);
478
- const motorMax = Math.max(...values);
479
- const motorRange = (motorMax - motorMin) || 1;
480
- const deltas = values.slice(1).map((v, i) => v - values[i]);
481
- if (deltas.length === 0)
482
- return { name: shortName(key), std: 0, maxAbs: 0, bins: new Array(30).fill(0), lo: 0, hi: 0, motorRange };
483
-
484
- // Activity score: p95 of |Δa|
485
- const absDeltas = deltas.map(Math.abs).sort((a, b) => a - b);
486
- const p95 = absDeltas[Math.floor(absDeltas.length * 0.95)];
487
- const inactive = p95 < motorRange * ACTIVITY_THRESHOLD;
488
-
489
- const mean = deltas.reduce((a, b) => a + b, 0) / deltas.length;
490
- const rawStd = Math.sqrt(
491
- deltas.reduce((a, d) => a + (d - mean) ** 2, 0) / deltas.length,
492
- );
493
- const std = rawStd / motorRange;
494
- const maxAbsRaw = Math.max(...absDeltas);
495
- const maxAbs = maxAbsRaw / motorRange;
496
-
497
- const binCount = 30;
498
- const lo = Math.min(...deltas) / motorRange;
499
- const hi = Math.max(...deltas) / motorRange;
500
- const range = hi - lo || 1;
501
- const binW = range / binCount;
502
- const bins: number[] = new Array(binCount).fill(0);
503
- for (const d of deltas) {
504
- const normD = d / motorRange;
505
- let b = Math.floor((normD - lo) / binW);
506
- if (b >= binCount) b = binCount - 1;
507
- bins[b]++;
508
- }
509
- return { name: shortName(key), std, maxAbs, bins, lo, hi, motorRange, inactive };
510
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
511
  }, [data, actionKeys, agg]);
512
 
513
  const stats = useMemo(
@@ -566,7 +594,10 @@ function ActionVelocitySection({
566
  );
567
  if (inactiveCount > 0)
568
  lines.push(
569
- `${inactiveCount} inactive (${stats.filter((s) => s.inactive).map((s) => s.name).join(", ")}) — excluded from computation`,
 
 
 
570
  );
571
 
572
  let tip: string;
@@ -616,8 +647,16 @@ function ActionVelocitySection({
616
  <br />
617
  <span className="text-slate-500">
618
  Relates to the Lipschitz constant L<sub>π</sub> and smoothness C
619
- <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 compounding
620
- error bounds (Assumptions 3.1, 4.1).
 
 
 
 
 
 
 
 
621
  </span>
622
  </p>
623
  </InfoToggle>
@@ -648,7 +687,9 @@ function ActionVelocitySection({
648
  </span>
649
  )}
650
  </p>
651
- <div className={`flex gap-2 text-xs tabular-nums ${dimmed ? "text-slate-600" : "text-slate-400"}`}>
 
 
652
  <span>σ={s.std.toFixed(4)}</span>
653
  <span>
654
  |Δ|<sub>max</sub>={s.maxAbs.toFixed(4)}
@@ -881,9 +922,17 @@ function VarianceHeatmap({
881
  indicate consistent behavior across demonstrations.
882
  <br />
883
  <span className="text-slate-500">
884
- Relates to the &quot;coverage&quot; discussion in <a href="https://arxiv.org/abs/2507.09061" target="_blank" rel="noopener noreferrer" className="underline hover:text-slate-300">Zhang et al.
885
- (2025)</a> — regions with low variance may lack the exploratory
886
- coverage needed to prevent compounding errors (Section 4).
 
 
 
 
 
 
 
 
887
  </span>
888
  </p>
889
  </InfoToggle>
@@ -1343,10 +1392,36 @@ function StateActionAlignmentSection({
1343
  commanded and when the corresponding state changes.
1344
  <br />
1345
  <span className="text-slate-500">
1346
- 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 compensates
1347
- for 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-Time
1348
- RTC (<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 mismatch
1349
- between commanded actions and observed state changes.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1350
  </span>
1351
  </p>
1352
  </InfoToggle>
@@ -1393,7 +1468,11 @@ function StateActionAlignmentSection({
1393
  fontSize: 13,
1394
  }}
1395
  />
1396
- <YAxis stroke="#94a3b8" domain={[-0.5, 1]} tickFormatter={(v) => Number(v.toFixed(2)).toString()} />
 
 
 
 
1397
  <Tooltip
1398
  contentStyle={{
1399
  background: "#1e293b",
 
351
  <br />
352
  <span className="text-slate-500">
353
  Grounded in the theoretical result that chunk length should
354
+ scale logarithmically with system stability constants (
355
+ <a
356
+ href="https://arxiv.org/abs/2507.09061"
357
+ target="_blank"
358
+ rel="noopener noreferrer"
359
+ className="underline hover:text-slate-300"
360
+ >
361
+ Zhang et al., 2025
362
+ </a>
363
+ , Theorem 1).
364
  </span>
365
  </p>
366
  </InfoToggle>
 
404
  fontSize: 13,
405
  }}
406
  />
407
+ <YAxis
408
+ stroke="#94a3b8"
409
+ domain={yDomain}
410
+ tickFormatter={(v) => Number(v.toFixed(2)).toString()}
411
+ />
412
  <Tooltip
413
  contentStyle={{
414
  background: "#1e293b",
 
483
  if (actionKeys.length === 0 || data.length < 2) return [];
484
 
485
  const ACTIVITY_THRESHOLD = 0.001; // 0.1% of motor range
486
+ return actionKeys.map((key) => {
487
+ const values = data.map((row) => row[key] ?? 0);
488
+ const motorMin = Math.min(...values);
489
+ const motorMax = Math.max(...values);
490
+ const motorRange = motorMax - motorMin || 1;
491
+ const deltas = values.slice(1).map((v, i) => v - values[i]);
492
+ if (deltas.length === 0)
493
+ return {
494
+ name: shortName(key),
495
+ std: 0,
496
+ maxAbs: 0,
497
+ bins: new Array(30).fill(0),
498
+ lo: 0,
499
+ hi: 0,
500
+ motorRange,
501
+ };
502
+
503
+ // Activity score: p95 of |Δa|
504
+ const absDeltas = deltas.map(Math.abs).sort((a, b) => a - b);
505
+ const p95 = absDeltas[Math.floor(absDeltas.length * 0.95)];
506
+ const inactive = p95 < motorRange * ACTIVITY_THRESHOLD;
507
+
508
+ const mean = deltas.reduce((a, b) => a + b, 0) / deltas.length;
509
+ const rawStd = Math.sqrt(
510
+ deltas.reduce((a, d) => a + (d - mean) ** 2, 0) / deltas.length,
511
+ );
512
+ const std = rawStd / motorRange;
513
+ const maxAbsRaw = Math.max(...absDeltas);
514
+ const maxAbs = maxAbsRaw / motorRange;
515
+
516
+ const binCount = 30;
517
+ const lo = Math.min(...deltas) / motorRange;
518
+ const hi = Math.max(...deltas) / motorRange;
519
+ const range = hi - lo || 1;
520
+ const binW = range / binCount;
521
+ const bins: number[] = new Array(binCount).fill(0);
522
+ for (const d of deltas) {
523
+ const normD = d / motorRange;
524
+ let b = Math.floor((normD - lo) / binW);
525
+ if (b >= binCount) b = binCount - 1;
526
+ bins[b]++;
527
+ }
528
+ return {
529
+ name: shortName(key),
530
+ std,
531
+ maxAbs,
532
+ bins,
533
+ lo,
534
+ hi,
535
+ motorRange,
536
+ inactive,
537
+ };
538
+ });
539
  }, [data, actionKeys, agg]);
540
 
541
  const stats = useMemo(
 
594
  );
595
  if (inactiveCount > 0)
596
  lines.push(
597
+ `${inactiveCount} inactive (${stats
598
+ .filter((s) => s.inactive)
599
+ .map((s) => s.name)
600
+ .join(", ")}) — excluded from computation`,
601
  );
602
 
603
  let tip: string;
 
647
  <br />
648
  <span className="text-slate-500">
649
  Relates to the Lipschitz constant L<sub>π</sub> and smoothness C
650
+ <sub>π</sub> in{" "}
651
+ <a
652
+ href="https://arxiv.org/abs/2507.09061"
653
+ target="_blank"
654
+ rel="noopener noreferrer"
655
+ className="underline hover:text-slate-300"
656
+ >
657
+ Zhang et al. (2025)
658
+ </a>
659
+ , which govern compounding error bounds (Assumptions 3.1, 4.1).
660
  </span>
661
  </p>
662
  </InfoToggle>
 
687
  </span>
688
  )}
689
  </p>
690
+ <div
691
+ className={`flex gap-2 text-xs tabular-nums ${dimmed ? "text-slate-600" : "text-slate-400"}`}
692
+ >
693
  <span>σ={s.std.toFixed(4)}</span>
694
  <span>
695
  |Δ|<sub>max</sub>={s.maxAbs.toFixed(4)}
 
922
  indicate consistent behavior across demonstrations.
923
  <br />
924
  <span className="text-slate-500">
925
+ Relates to the &quot;coverage&quot; discussion in{" "}
926
+ <a
927
+ href="https://arxiv.org/abs/2507.09061"
928
+ target="_blank"
929
+ rel="noopener noreferrer"
930
+ className="underline hover:text-slate-300"
931
+ >
932
+ Zhang et al. (2025)
933
+ </a>{" "}
934
+ — regions with low variance may lack the exploratory coverage
935
+ needed to prevent compounding errors (Section 4).
936
  </span>
937
  </p>
938
  </InfoToggle>
 
1392
  commanded and when the corresponding state changes.
1393
  <br />
1394
  <span className="text-slate-500">
1395
+ Central to ACT (
1396
+ <a
1397
+ href="https://arxiv.org/abs/2304.13705"
1398
+ target="_blank"
1399
+ rel="noopener noreferrer"
1400
+ className="underline hover:text-slate-300"
1401
+ >
1402
+ Zhao et al., 2023
1403
+ </a>{" "}
1404
+ — action chunking compensates for delay), Real-Time Chunking
1405
+ (RTC,{" "}
1406
+ <a
1407
+ href="https://arxiv.org/abs/2506.07339"
1408
+ target="_blank"
1409
+ rel="noopener noreferrer"
1410
+ className="underline hover:text-slate-300"
1411
+ >
1412
+ Black et al., 2025
1413
+ </a>
1414
+ ), and Training-Time RTC (
1415
+ <a
1416
+ href="https://arxiv.org/abs/2512.05964"
1417
+ target="_blank"
1418
+ rel="noopener noreferrer"
1419
+ className="underline hover:text-slate-300"
1420
+ >
1421
+ Black et al., 2025
1422
+ </a>
1423
+ ) — all address the timing mismatch between commanded actions
1424
+ and observed state changes.
1425
  </span>
1426
  </p>
1427
  </InfoToggle>
 
1468
  fontSize: 13,
1469
  }}
1470
  />
1471
+ <YAxis
1472
+ stroke="#94a3b8"
1473
+ domain={[-0.5, 1]}
1474
+ tickFormatter={(v) => Number(v.toFixed(2)).toString()}
1475
+ />
1476
  <Tooltip
1477
  contentStyle={{
1478
  background: "#1e293b",