Add date and color to results list

This commit is contained in:
2022-01-31 11:46:54 +01:00
parent e770eaec6c
commit fd3f8652ce
3 changed files with 28 additions and 8 deletions

View File

@@ -45,3 +45,14 @@ python src/benchmark.py
# Do benchmark, print report and build excel file with data # Do benchmark, print report and build excel file with data
python src/benchmark.py -x 1 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
```

View File

@@ -1,4 +1,3 @@
from cgitb import text
import os import os
import json import json
import abc import abc
@@ -700,7 +699,7 @@ class Summary:
self.datasets[result] = report.lines self.datasets[result] = report.lines
self.data.append(entry) 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""" """Print the list of results"""
data = self.data.copy() data = self.data.copy()
if score: if score:
@@ -710,14 +709,24 @@ class Summary:
data = sorted(data, key=lambda x: x["date"], reverse=True) data = sorted(data, key=lambda x: x["date"], reverse=True)
max_file = max(len(x["file"]) for x in data) max_file = max(len(x["file"]) for x in data)
max_title = max(len(x["title"]) 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(TextColor.LINE1, end="")
print("=" * max_file + " " + "=" * 7 + " " + "=" * max_title) print(f"{'Date':10s} {'File':{max_file}s} {'Score':7s} {'Title':s}")
print(
"=" * 10
+ " "
+ "=" * max_file
+ " "
+ "=" * 7
+ " "
+ "=" * max_title
)
print( print(
"\n".join( "\n".join(
[ [
f"{x['file']:{max_file}s} {x['metric']:7.3f} " (TextColor.LINE2 if n % 2 == 0 else TextColor.LINE1)
f"{x['title']}" + f"{x['date']} {x['file']:{max_file}s} "
for x in data f"{x['metric']:7.3f} {x['title']}"
for n, x in enumerate(data)
] ]
) )
) )

View File

@@ -37,4 +37,4 @@ def parse_arguments():
data = Summary() data = Summary()
data.acquire() data.acquire()
data.list(score, model) data.list_results(score, model)