Pybunny commited on
Commit
ba9d7ae
·
verified ·
1 Parent(s): 923bec7

Add paper-baselines comparison table

Browse files
Files changed (1) hide show
  1. app.py +32 -10
app.py CHANGED
@@ -368,18 +368,40 @@ def _score_demo_pt(weights_file, n_frames):
368
  cork = (Ak & Bk & eok).sum()
369
  per_class.append((c, float(cork / unionk) if unionk > 0 else 0.0))
370
 
 
 
 
 
 
 
 
 
 
 
 
 
 
371
  md = []
372
  md.append(f"# NILMbench — uploaded .pt\n")
373
- md.append(f"_Scored on {len(x)} of {total} dense House-2 frames._\n")
374
- md.append("## Headline score sheet\n")
375
- md.append("| Metric | Value |")
376
- md.append("|---|---|")
377
- md.append(f"| MJ_20W (headline) | {mj:.4f} |")
378
- md.append(f"| F1 | {f1:.4f} |")
379
- md.append(f"| Jaccard | {jacc:.4f} |")
380
- md.append(f"| TECA | {teca:.4f} |")
381
- md.append(f"| MAE (W) | {mae:.2f} |\n")
382
- md.append("## Per-category MJ_20W\n")
 
 
 
 
 
 
 
 
 
383
  md.append("| Category | MJ_20W |")
384
  md.append("|---|---|")
385
  for c, v in per_class:
 
368
  cork = (Ak & Bk & eok).sum()
369
  per_class.append((c, float(cork / unionk) if unionk > 0 else 0.0))
370
 
371
+ # Paper baselines (Table 3 of the NILMbench manuscript; full 60 000 frames).
372
+ PAPER_BASELINES = [
373
+ # name, MJ_20W, F1, Jaccard, TECA, MAE_W
374
+ ("DeepDFML", 0.316, 0.658, 0.532, 0.513, 38.64),
375
+ ("COLD", 0.375, 0.714, 0.600, 0.580, 37.53),
376
+ ("SchirmerCNN", 0.412, 0.766, 0.667, 0.622, 45.25),
377
+ ("FaustineCNN", 0.504, 0.790, 0.698, 0.706, 29.64),
378
+ ("FaustineCNN + recall-constr. cutoffs", 0.562, 0.811, 0.729, 0.739, 27.09),
379
+ ("predict zero (trivial)", 0.000, 0.000, 0.000, 0.500, 67.60),
380
+ ("predict House-2 mean (trivial)", 0.227, 0.579, 0.450, -0.105, 60.70),
381
+ ("all to 'always on' (trivial)", 0.019, 0.557, 0.412, 0.165, 76.40),
382
+ ]
383
+
384
  md = []
385
  md.append(f"# NILMbench — uploaded .pt\n")
386
+ md.append(f"_Your model scored on {len(x)} of {total} dense House-2 frames._\n")
387
+
388
+ md.append("## Comparison to paper baselines")
389
+ md.append("")
390
+ md.append("Baselines below are from Table 3 of the NILMbench paper, computed "
391
+ "on the full 60 000-frame dense House-2 set. **Your model is scored "
392
+ f"on the first {len(x)} frames only** (Space free-tier compute budget); "
393
+ "treat the comparison as directional. Use the `nilmbench` CLI locally "
394
+ "to score on all 60 000 frames for a fair comparison.\n")
395
+ md.append("| Model | MJ\\_{20W} | F1 | Jaccard | TECA | MAE (W) |")
396
+ md.append("|---|---|---|---|---|---|")
397
+ md.append(f"| **Your model (uploaded)** | **{mj:.4f}** | **{f1:.4f}** | "
398
+ f"**{jacc:.4f}** | **{teca:.4f}** | **{mae:.2f}** |")
399
+ for name, b_mj, b_f1, b_j, b_teca, b_mae in PAPER_BASELINES:
400
+ md.append(f"| {name} | {b_mj:.4f} | {b_f1:.4f} | {b_j:.4f} | "
401
+ f"{b_teca:.4f} | {b_mae:.2f} |")
402
+ md.append("")
403
+
404
+ md.append("## Per-category MJ\\_{20W} (your model)\n")
405
  md.append("| Category | MJ_20W |")
406
  md.append("|---|---|")
407
  for c, v in per_class: