Add hours to report headers

This commit is contained in:
2022-01-21 19:15:02 +01:00
parent 871ad738d8
commit 5646521ed0

View File

@@ -154,9 +154,10 @@ class Report(BaseReport):
f" Random seeds: {self.data['seeds']} Stratified: " f" Random seeds: {self.data['seeds']} Stratified: "
f"{self.data['stratified']}" f"{self.data['stratified']}"
) )
hours = self.data["duration"] / 3600
self.header_line( self.header_line(
f" Execution took {self.data['duration']:7.2f} seconds on " f" Execution took {self.data['duration']:7.2f} seconds, "
f"{self.data['platform']}" f" {hours:5.2f} hours, on {self.data['platform']}"
) )
self.header_line(f" Score is {self.data['score_name']}") self.header_line(f" Score is {self.data['score_name']}")
self.header_line("*") self.header_line("*")
@@ -199,7 +200,7 @@ class ReportBest(BaseReport):
self.score_name = score self.score_name = score
self.model = model 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 length = sum(self.header_lengths) + len(self.header_lengths) - 3
if text == "*": if text == "*":
print("*" * (length + 2)) print("*" * (length + 2))
@@ -275,8 +276,8 @@ class Excel(BaseReport):
0, 0,
f" Report {self.data['model']} ver. {self.data['version']}" f" Report {self.data['model']} ver. {self.data['version']}"
f" with {self.data['folds']} Folds " f" with {self.data['folds']} Folds "
f"cross validation and {len(self.data['seeds'])} random seeds. ", f"cross validation and {len(self.data['seeds'])} random seeds. "
f"{self.data['date']} {self.data['time']}" f"{self.data['date']} {self.data['time']}",
header, header,
) )
self.sheet.write( self.sheet.write(
@@ -285,11 +286,12 @@ class Excel(BaseReport):
f" {self.data['title']}", f" {self.data['title']}",
subheader, subheader,
) )
hours = self.data["duration"] / 3600
self.sheet.write( self.sheet.write(
2, 2,
0, 0,
f" Execution took {self.data['duration']:7.2f} seconds on " f" Execution took {self.data['duration']:7.2f} seconds, "
f"{self.data['platform']}", f" {hours:5.2f} hours, on {self.data['platform']}",
subheader, subheader,
) )
self.sheet.write( self.sheet.write(