Thibaut Forest Claude Opus 5 (1M context) commited on
Commit
1cefc38
·
1 Parent(s): b6d4319

CV: SCORE = summed folds per scenario (all-building out-of-fold total, familiar full-fleet magnitude); champion baseline 1760.2

Browse files
Files changed (2) hide show
  1. EXPERIMENTS.md +9 -0
  2. batteryswap_example/cv.py +29 -21
EXPERIMENTS.md CHANGED
@@ -3181,3 +3181,12 @@ is what protects against it, not the harness.
3181
  THE CV going forward: v5 building-GroupKFold (deployment-faithful held-out
3182
  simulation, one instrument for public AND private - both are ~2x held-out
3183
  fleets), used for ordering/model questions under the quarantine rules.
 
 
 
 
 
 
 
 
 
 
3181
  THE CV going forward: v5 building-GroupKFold (deployment-faithful held-out
3182
  simulation, one instrument for public AND private - both are ~2x held-out
3183
  fleets), used for ordering/model questions under the quarantine rules.
3184
+
3185
+ Phase 58 addendum (user): SCORE aggregation switched to the familiar
3186
+ full-fleet magnitude - per scenario the 5 fold costs are SUMMED (every
3187
+ building is out-of-fold exactly once per scenario -> the sum is the
3188
+ all-24-building out-of-fold cost), SCORE = mean of the 48 totals.
3189
+ **Champion baseline: SCORE = 1760.2** (warmup 2616.1 / panel 1773.4 /
3190
+ nearend 544.0; swaps 9.5/scenario). Identical information to the fold-mean
3191
+ form (352.0 x 5), same paired decisions; stale pre-v5 candidate CSVs purged
3192
+ from /tmp (only the phase-58 faithful runs remain valid).
batteryswap_example/cv.py CHANGED
@@ -10,7 +10,11 @@ TEST buildings are planned as a STANDALONE fleet with the DEPLOYMENT-EXACT
10
  planner state (submit.py's static-path knobs, including the cold-start
11
  floor gate, which is structurally inert here because every fold trains on
12
  60+ unique deaths vs the gate's 20) and costed by the real evaluator.
13
- THE SCORE is the mean over folds of the fold's mean scenario cost.
 
 
 
 
14
 
15
  Fidelity pass (v5): this harness is the closest possible local twin of the
16
  held-out deployment path - both public and private splits are ~2x unseen
@@ -256,27 +260,30 @@ def run_bgkf(dataset_path=Path('dataset'), kind=None, variant='base',
256
 
257
 
258
  def report(df):
259
- """Fold table + scenario-block scorecard + THE SCORE (single value)."""
260
- print('\n=== building-GroupKFold / test group planned as a fleet / '
261
- 'floor off ===')
262
  print(f"{'fold':>4s} {'n':>3s} {'total':>8s} {'late':>7s} {'early':>6s} "
263
  f"{'swaps':>5s}")
264
  for f, d in df.groupby('fold'):
265
  print(f"{f:4d} {len(d):3d} {d['total_cost'].mean():8.1f} "
266
  f"{d['late_swap'].mean():7.1f} {d['early_swap'].mean():6.1f} "
267
  f"{d['n_swaps'].mean():5.1f}")
 
 
 
 
268
  print(f"\n{'block':16s} {'n':>3s} {'total':>8s} {'late':>7s} "
269
- f"{'early':>6s} {'swaps':>5s}")
270
  for name, sel in BLOCKS:
271
- d = df[sel(df['origin'])]
272
  if d.empty:
273
  continue
274
  print(f"{name:16s} {len(d):3d} {d['total_cost'].mean():8.1f} "
275
  f"{d['late_swap'].mean():7.1f} {d['early_swap'].mean():6.1f} "
276
  f"{d['n_swaps'].mean():5.1f}")
277
- score = df.groupby('fold')['total_cost'].mean().mean()
278
- print(f"\nSCORE (building-GroupKFold, mean over folds of fold-mean "
279
- f"cost): {score:.1f}")
280
 
281
 
282
  # --------------------------------------------------------------------------
@@ -301,26 +308,27 @@ def candidate_report(base_csv='/tmp/cv_bgkf.csv',
301
  pattern='/tmp/cv_bgkfcand_*.csv'):
302
  import glob
303
  base = pd.read_csv(base_csv)
304
- b = base.set_index(['fold', 'origin'])
305
- print('paired vs champion (logbag/base, building-GroupKFold, floor off).')
 
306
  print('swaps (plan-derived) shown because a cost delta can be appetite '
307
  'in disguise: trust a win only if swaps is ~flat, and check the '
308
- 'PER-CELL count swing, not just the mean (phase 56 lesson).\n')
309
  print(f"{'candidate':14s} {'SCORE':>7s} {'delta':>7s} {'SE':>6s} "
310
  f"{'W/L':>7s} {'swaps':>5s}")
311
- bs = b.groupby('fold')['total_cost'].mean().mean()
312
- print(f"{'base':14s} {bs:7.1f} {'-':>7s} {'-':>6s} {'-':>7s} "
313
- f"{b['n_swaps'].mean():5.1f}")
314
  out = []
315
  for fn in sorted(glob.glob(pattern)):
316
- d = pd.read_csv(fn).set_index(['fold', 'origin'])
317
- label = d['cand'].iloc[0]
 
318
  delta = (d['total_cost'] - b['total_cost']).dropna()
319
- score = d.groupby('fold')['total_cost'].mean().mean()
320
- out.append((delta.mean(), label, score, delta, d))
321
- for _, label, score, delta, d in sorted(out):
322
  se = delta.std() / np.sqrt(len(delta))
323
- print(f"{label:14s} {score:7.1f} {delta.mean():+7.1f} {se:6.1f} "
 
324
  f"{int((delta < 0).sum()):3d}W/{int((delta > 0).sum()):2d}L "
325
  f"{d['n_swaps'].mean():5.1f}")
326
 
 
10
  planner state (submit.py's static-path knobs, including the cold-start
11
  floor gate, which is structurally inert here because every fold trains on
12
  60+ unique deaths vs the gate's 20) and costed by the real evaluator.
13
+ THE SCORE: per scenario, the fold costs are SUMMED - every building sits
14
+ in exactly one test fold, so the sum is the out-of-fold cost of ALL 24
15
+ buildings for that scenario - and THE SCORE is the mean of those 48
16
+ all-building totals. Same information as the fold-mean average (x5), but in
17
+ the familiar full-fleet-per-scenario magnitude.
18
 
19
  Fidelity pass (v5): this harness is the closest possible local twin of the
20
  held-out deployment path - both public and private splits are ~2x unseen
 
260
 
261
 
262
  def report(df):
263
+ """Fold table + all-building scenario scorecard + THE SCORE."""
264
+ print('\n=== building-GroupKFold / test groups planned as fleets / '
265
+ 'folds summed per scenario ===')
266
  print(f"{'fold':>4s} {'n':>3s} {'total':>8s} {'late':>7s} {'early':>6s} "
267
  f"{'swaps':>5s}")
268
  for f, d in df.groupby('fold'):
269
  print(f"{f:4d} {len(d):3d} {d['total_cost'].mean():8.1f} "
270
  f"{d['late_swap'].mean():7.1f} {d['early_swap'].mean():6.1f} "
271
  f"{d['n_swaps'].mean():5.1f}")
272
+ # per-scenario all-building totals: sum across folds (each building is
273
+ # out-of-fold exactly once per scenario)
274
+ g = df.groupby('origin')[['total_cost', 'late_swap', 'early_swap',
275
+ 'n_swaps']].sum()
276
  print(f"\n{'block':16s} {'n':>3s} {'total':>8s} {'late':>7s} "
277
+ f"{'early':>6s} {'swaps':>5s} (all buildings, per scenario)")
278
  for name, sel in BLOCKS:
279
+ d = g[sel(g.index)]
280
  if d.empty:
281
  continue
282
  print(f"{name:16s} {len(d):3d} {d['total_cost'].mean():8.1f} "
283
  f"{d['late_swap'].mean():7.1f} {d['early_swap'].mean():6.1f} "
284
  f"{d['n_swaps'].mean():5.1f}")
285
+ print(f"\nSCORE (all-building out-of-fold cost, mean over the 48 "
286
+ f"scenarios): {g['total_cost'].mean():.1f}")
 
287
 
288
 
289
  # --------------------------------------------------------------------------
 
308
  pattern='/tmp/cv_bgkfcand_*.csv'):
309
  import glob
310
  base = pd.read_csv(base_csv)
311
+ b = base.groupby('origin')[['total_cost', 'n_swaps']].sum()
312
+ print('paired vs champion (logbag/base, building-GroupKFold; folds '
313
+ 'summed per scenario -> 48 paired all-building totals).')
314
  print('swaps (plan-derived) shown because a cost delta can be appetite '
315
  'in disguise: trust a win only if swaps is ~flat, and check the '
316
+ 'PER-SCENARIO count swing, not just the mean (phase 56 lesson).\n')
317
  print(f"{'candidate':14s} {'SCORE':>7s} {'delta':>7s} {'SE':>6s} "
318
  f"{'W/L':>7s} {'swaps':>5s}")
319
+ print(f"{'base':14s} {b['total_cost'].mean():7.1f} {'-':>7s} {'-':>6s} "
320
+ f"{'-':>7s} {b['n_swaps'].mean():5.1f}")
 
321
  out = []
322
  for fn in sorted(glob.glob(pattern)):
323
+ d = (pd.read_csv(fn).groupby('origin')
324
+ [['total_cost', 'n_swaps']].sum())
325
+ label = pd.read_csv(fn)['cand'].iloc[0]
326
  delta = (d['total_cost'] - b['total_cost']).dropna()
327
+ out.append((delta.mean(), label, d, delta))
328
+ for _, label, d, delta in sorted(out):
 
329
  se = delta.std() / np.sqrt(len(delta))
330
+ print(f"{label:14s} {d['total_cost'].mean():7.1f} "
331
+ f"{delta.mean():+7.1f} {se:6.1f} "
332
  f"{int((delta < 0).sum()):3d}W/{int((delta > 0).sum()):2d}L "
333
  f"{d['n_swaps'].mean():5.1f}")
334