mirror of
https://github.com/Doctorado-ML/benchmark.git
synced 2025-08-17 16:35:54 +00:00
Complete pair_check & hidden results
This commit is contained in:
38
src/pair_check.py
Normal file → Executable file
38
src/pair_check.py
Normal file → Executable file
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env python
|
||||
import argparse
|
||||
from Experiments import Experiment, Datasets
|
||||
from Results import Report
|
||||
from Utils import EnvDefault
|
||||
import os
|
||||
from Results import Summary, StubReport
|
||||
from Utils import EnvDefault, Folders, BEST_ACCURACY_STREE
|
||||
|
||||
"""Check best results of two models giving scores and win-tie-loose results
|
||||
"""
|
||||
@@ -36,7 +36,8 @@ def parse_arguments():
|
||||
args = ap.parse_args()
|
||||
return (
|
||||
args.score,
|
||||
args.model1 < args.model2,
|
||||
args.model1,
|
||||
args.model2,
|
||||
)
|
||||
|
||||
|
||||
@@ -45,3 +46,32 @@ def parse_arguments():
|
||||
model1,
|
||||
model2,
|
||||
) = parse_arguments()
|
||||
|
||||
summary = Summary()
|
||||
summary.acquire()
|
||||
win = tie = loose = 0
|
||||
best_1 = summary.best_result(criterion="model", value=model1, score=score)
|
||||
best_2 = summary.best_result(criterion="model", value=model2, score=score)
|
||||
report_1 = StubReport(os.path.join(Folders.results, best_1["file"]))
|
||||
report_1.report()
|
||||
report_2 = StubReport(os.path.join(Folders.results, best_2["file"]))
|
||||
report_2.report()
|
||||
for result1, result2 in zip(report_1.lines, report_2.lines):
|
||||
result = result1["score"] - result2["score"]
|
||||
if result > 0:
|
||||
win += 1
|
||||
elif result < 0:
|
||||
loose += 1
|
||||
else:
|
||||
tie += 1
|
||||
print(f"{'Model':<20} {'File':<70} {'Score':<10} Win Tie Loose")
|
||||
print("=" * 20 + " " + "=" * 70 + " " + "=" * 10 + " === === =====")
|
||||
print(
|
||||
f"{model1:<20} {best_1['file']:<70} "
|
||||
f"{report_1.accuracy / BEST_ACCURACY_STREE:10.5f}"
|
||||
)
|
||||
print(
|
||||
f"{model2:<20} {best_2['file']:<70} "
|
||||
f"{report_2.accuracy / BEST_ACCURACY_STREE:10.5f} "
|
||||
f"{win:3d} {tie:3d} {loose:5d}"
|
||||
)
|
||||
|
Reference in New Issue
Block a user