mirror of
https://github.com/Doctorado-ML/benchmark.git
synced 2025-08-15 23:45:54 +00:00
Add date and color to results list
This commit is contained in:
11
README.md
11
README.md
@@ -45,3 +45,14 @@ python src/benchmark.py
|
||||
# Do benchmark, print report and build excel file with data
|
||||
python src/benchmark.py -x 1
|
||||
```
|
||||
|
||||
## List
|
||||
|
||||
```python
|
||||
# List of results of given model
|
||||
python src/list.py -m ODTE
|
||||
# List of results of given model and score
|
||||
python src/list.py -m STree -s f1-macro
|
||||
# List all results
|
||||
python src/list.py
|
||||
```
|
||||
|
@@ -1,4 +1,3 @@
|
||||
from cgitb import text
|
||||
import os
|
||||
import json
|
||||
import abc
|
||||
@@ -700,7 +699,7 @@ class Summary:
|
||||
self.datasets[result] = report.lines
|
||||
self.data.append(entry)
|
||||
|
||||
def list(self, score=None, model=None) -> None:
|
||||
def list_results(self, score=None, model=None) -> None:
|
||||
"""Print the list of results"""
|
||||
data = self.data.copy()
|
||||
if score:
|
||||
@@ -710,14 +709,24 @@ class Summary:
|
||||
data = sorted(data, key=lambda x: x["date"], reverse=True)
|
||||
max_file = max(len(x["file"]) for x in data)
|
||||
max_title = max(len(x["title"]) for x in data)
|
||||
print(f"{'File':{max_file}s} {'Score':7s} {'Title':s}")
|
||||
print("=" * max_file + " " + "=" * 7 + " " + "=" * max_title)
|
||||
print(TextColor.LINE1, end="")
|
||||
print(f"{'Date':10s} {'File':{max_file}s} {'Score':7s} {'Title':s}")
|
||||
print(
|
||||
"=" * 10
|
||||
+ " "
|
||||
+ "=" * max_file
|
||||
+ " "
|
||||
+ "=" * 7
|
||||
+ " "
|
||||
+ "=" * max_title
|
||||
)
|
||||
print(
|
||||
"\n".join(
|
||||
[
|
||||
f"{x['file']:{max_file}s} {x['metric']:7.3f} "
|
||||
f"{x['title']}"
|
||||
for x in data
|
||||
(TextColor.LINE2 if n % 2 == 0 else TextColor.LINE1)
|
||||
+ f"{x['date']} {x['file']:{max_file}s} "
|
||||
f"{x['metric']:7.3f} {x['title']}"
|
||||
for n, x in enumerate(data)
|
||||
]
|
||||
)
|
||||
)
|
||||
|
@@ -37,4 +37,4 @@ def parse_arguments():
|
||||
|
||||
data = Summary()
|
||||
data.acquire()
|
||||
data.list(score, model)
|
||||
data.list_results(score, model)
|
||||
|
Reference in New Issue
Block a user