From 5646521ed024f1c4873e35f76309562b2a4bc3d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Monta=C3=B1ana?= Date: Fri, 21 Jan 2022 19:15:02 +0100 Subject: [PATCH] Add hours to report headers --- src/Results.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Results.py b/src/Results.py index beef6d1..60a63fb 100644 --- a/src/Results.py +++ b/src/Results.py @@ -154,9 +154,10 @@ class Report(BaseReport): f" Random seeds: {self.data['seeds']} Stratified: " f"{self.data['stratified']}" ) + hours = self.data["duration"] / 3600 self.header_line( - f" Execution took {self.data['duration']:7.2f} seconds on " - f"{self.data['platform']}" + f" Execution took {self.data['duration']:7.2f} seconds, " + f" {hours:5.2f} hours, on {self.data['platform']}" ) self.header_line(f" Score is {self.data['score_name']}") self.header_line("*") @@ -199,7 +200,7 @@ class ReportBest(BaseReport): self.score_name = score self.model = model - def header_line(self, text): + def header_line(self, text: str) -> None: length = sum(self.header_lengths) + len(self.header_lengths) - 3 if text == "*": print("*" * (length + 2)) @@ -275,8 +276,8 @@ class Excel(BaseReport): 0, f" Report {self.data['model']} ver. {self.data['version']}" f" with {self.data['folds']} Folds " - f"cross validation and {len(self.data['seeds'])} random seeds. ", - f"{self.data['date']} {self.data['time']}" + f"cross validation and {len(self.data['seeds'])} random seeds. " + f"{self.data['date']} {self.data['time']}", header, ) self.sheet.write( @@ -285,11 +286,12 @@ class Excel(BaseReport): f" {self.data['title']}", subheader, ) + hours = self.data["duration"] / 3600 self.sheet.write( 2, 0, - f" Execution took {self.data['duration']:7.2f} seconds on " - f"{self.data['platform']}", + f" Execution took {self.data['duration']:7.2f} seconds, " + f" {hours:5.2f} hours, on {self.data['platform']}", subheader, ) self.sheet.write(