File size: 1,924 Bytes
f1e6aff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3
"""Exemples de chargement (local ou, après publication, depuis le Hub).
  pip install datasets   # optionnel
"""
import json, sys

# 1) Hugging Face `datasets` (après publication ; REPO_ID à confirmer au GO)
#   from datasets import load_dataset
#   ev = load_dataset("gemmozero/mcp-tool-change-events", "events")          # splits: train / test (temporel)
#   bm = load_dataset("gemmozero/mcp-tool-change-events", "benchmark")       # splits: train / test (par serveur)

# 2) Sans dépendance : JSON Lines
import os
import pandas as pd
ev = pd.read_parquet("data/events/train.parquet").to_dict("records")
bm = pd.read_parquet("data/benchmark/test.parquet").to_dict("records") if os.path.exists("data/benchmark/test.parquet") else []
print(len(ev), "events (train);", len(bm), "benchmark rows (test)")
if not bm:
    raise SystemExit(0)

# 3) Tâche benchmark minimale : prédire `label` (added/removed/modified/unchanged) à partir de before/after,
#    ou `description_changed` / `schema_changed`. Baseline exacte (diff textuel) pour vérifier le chargement :
correct = sum(((x["before_definition"] is None and x["label"] == "added") or (x["after_definition"] is None and x["label"] == "removed") or
               (x["before_definition"] is not None and x["after_definition"] is not None and
                (x["label"] == "unchanged") == (json.loads(x["before_definition"]).get("description") == json.loads(x["after_definition"]).get("description") and
                                                 json.dumps(json.loads(x["before_definition"]).get("inputSchema"), sort_keys=True) == json.dumps(json.loads(x["after_definition"]).get("inputSchema"), sort_keys=True))))
              for x in bm)
print("exact-diff baseline agreement on test:", correct, "/", len(bm))

# 4) Vérifier un record hors ligne : python3 verify.py (signatures Ed25519 + preuves d'inclusion Merkle échantillonnées)