Download scripts/labelcheck.py from CyberNative-AI/so-arm-task-clock: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/datasets/CyberNative-AI/so-arm-task-clock/resolve/main/scripts/labelcheck.py
- Command line
-
hf download hf://datasets/CyberNative-AI/so-arm-task-clock/scripts/labelcheck.py
-
curl -L -o labelcheck.py https://huggingface.co/datasets/CyberNative-AI/so-arm-task-clock/resolve/main/scripts/labelcheck.py
1.02 kB
| """Instrument check: family rules against hand labels. | |
| usage: labelcheck.py LABEL_META.jsonl labels.tsv | |
| LABEL_META.jsonl is fetch.py output for the ids in labels.tsv (columns n, id, hand_label, rule_family). Reads only; | |
| writes nothing. Reports rule-vs-hand agreement and any row whose stored rule_family differs from the current rules.""" | |
| import sys, os, json | |
| sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) | |
| import classify | |
| if len(sys.argv) < 3: | |
| sys.exit(__doc__) | |
| meta = {} | |
| for l in open(sys.argv[1]): | |
| if l.strip(): | |
| d = json.loads(l); meta[d["id"]] = d | |
| rows = [l.rstrip("\n").split("\t") for l in open(sys.argv[2])][1:] | |
| ok = stale = 0 | |
| for n, i, hand, stored, *_ in rows: | |
| f = classify.family(meta[i]); ok += f == hand | |
| if f != hand: print("miss", n, i, "hand", hand, "rule", f) | |
| if f != stored: stale += 1; print("stale rule_family", n, i, "stored", stored, "now", f) | |
| print(f"agree {ok}/{len(rows)} = {ok/len(rows):.1%} (rule needed 85%); stale stored rule_family rows: {stale}") | |