Delete raven/hard_mining.py
Browse files- raven/hard_mining.py +0 -14
raven/hard_mining.py
DELETED
|
@@ -1,14 +0,0 @@
|
|
| 1 |
-
from __future__ import annotations
|
| 2 |
-
from .evaluate import evaluate_cache
|
| 3 |
-
from .utils import write_jsonl
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
def mine_hard(model_path:str,cache_path:str,out_path:str,split:str="test",confidence:float=.80):
|
| 7 |
-
report=evaluate_cache(model_path,cache_path,split); hard=[]
|
| 8 |
-
for r in report["predictions"]:
|
| 9 |
-
p=float(r.get("balanced_ai_probability",r.get("ai_probability",.5))); y=int(r["label"]); v=r["verdict"]
|
| 10 |
-
wrong_confident=(y==0 and p>=confidence) or (y==1 and p<=1-confidence)
|
| 11 |
-
uncertain=v=="UNCERTAIN"
|
| 12 |
-
if wrong_confident or uncertain:
|
| 13 |
-
x=dict(r); x["hard_type"]="confident_wrong" if wrong_confident else "uncertain"; x["hard_weight"]=2.0 if wrong_confident else 1.35; hard.append(x)
|
| 14 |
-
write_jsonl(out_path,hard); return {"count":len(hard),"split":split,"output":out_path,"metrics":report["total"]}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|