From 6844d13973795bc7db55b121b573e82e02102162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Montan=CC=83ana?= Date: Mon, 26 Jun 2023 11:07:12 +0200 Subject: [PATCH] Update format to report --- benchmark/scripts/app/main.py | 4 +- .../app/templates/partials/table_report.html | 36 ++--- .../partials/table_report_bootstrap.html | 151 +++++++++-------- .../partials/table_report_bulma.html | 153 +++++++++--------- 4 files changed, 177 insertions(+), 167 deletions(-) diff --git a/benchmark/scripts/app/main.py b/benchmark/scripts/app/main.py index 9e7a3e3..446b9da 100755 --- a/benchmark/scripts/app/main.py +++ b/benchmark/scripts/app/main.py @@ -3,6 +3,7 @@ import os import json import shutil import xlsxwriter +from dotenv import dotenv_values from benchmark.Utils import Files, Folders from benchmark.Arguments import EnvData from benchmark.ResultsBase import StubReport @@ -99,7 +100,7 @@ def datasets(compare): def showfile(file_name, compare, back=None): compare = compare.capitalize() == "True" back = request.args["url"] if back is None else back - print(f"back [{back}]") + app_config = dotenv_values(".env") with open(os.path.join(Folders.results, file_name)) as f: data = json.load(f) try: @@ -113,6 +114,7 @@ def showfile(file_name, compare, back=None): summary=summary, framework=current_app.config[FRAMEWORK], back=back, + app_config=app_config, ) diff --git a/benchmark/scripts/app/templates/partials/table_report.html b/benchmark/scripts/app/templates/partials/table_report.html index 47855d9..e572dd0 100644 --- a/benchmark/scripts/app/templates/partials/table_report.html +++ b/benchmark/scripts/app/templates/partials/table_report.html @@ -1,28 +1,14 @@ {% for item in data.results %} - - {{item.dataset}} - - - {{'{:,}'.format(item.samples)}} - - - {{"%d" % item.features}} - - - {{"%d" % item.classes}} - - - {{'{:,.2f}'.format(item.nodes)}} - - - {{"%.6f±%.4f" % (item.score, item.score_std)}} {{ item.symbol|safe }} - - - {{"%.6f±%.4f" % (item.time, item.time_std)}} - - - {{item.hyperparameters}} - + {{ item.dataset }} + {{ '{:,}'.format(item.samples) }} + {{"%d" % item.features}} + {{"%d" % item.classes}} + {{ '{:,.2f}'.format(item.nodes|float) }} + {{ '{:,.2f}'.format(item.leaves|float) }} + {{ '{:,.2f}'.format(item.depth|float) }} + {{"%.6f±%.4f" % (item.score, item.score_std)}} {{ item.symbol|safe }} + {{"%.6f±%.4f" % (item.time, item.time_std)}} + {{ item.hyperparameters }} -{% endfor %} \ No newline at end of file +{% endfor %} diff --git a/benchmark/scripts/app/templates/partials/table_report_bootstrap.html b/benchmark/scripts/app/templates/partials/table_report_bootstrap.html index 9484a24..8be1437 100644 --- a/benchmark/scripts/app/templates/partials/table_report_bootstrap.html +++ b/benchmark/scripts/app/templates/partials/table_report_bootstrap.html @@ -1,69 +1,77 @@
-
-
-
- -

{{ data.title }}

-
-
- - - - - - - - {% if data.duration > 7200 %} +
+
+
+ +

{{ data.title }}

+
+
+
PlatformModelDateTime
+ + + + + + + {% if data.duration > 7200 %} {% set unit = "h" %} {% set divider = 3600 %} - {% else %} + {% else %} {% set unit = "min" %} {% set divider = 60 %} - {% endif %} - - - - - - - - - - - - - - - - - - - - - - -
PlatformModelDateTimeDuration ({{ unit }})StratifiedDiscretized# Folds
{{ data.platform }}{{ data.model }} {{ data.version }}{{ data.date}}{{ data.time}}{{ "%.2f" % (data.duration/divider) }}{{ data.stratified }}{{ data.discretized }}{{ data.folds }}
Language{{ data.language }} {{ data.language_version }}Seeds{{ data.seeds }}
-
- -
- - - - - - - - - - - - - - + {% endif %} + + + + + + + + + + + + + + + + + + + + + + +
DatasetSamplesFeaturesClassesNodes{{data.score_name|capitalize}}Timehyperparameters
Duration ({{ unit }})StratifiedDiscretized# Folds
{{ data.platform }}{{ data.model }} {{ data.version }}{{ data.date }}{{ data.time }}{{ "%.2f" % (data.duration/divider) }}{{ data.stratified }}{{ data.discretized }}{{ data.folds }}
Language{{ data.language }} {{ data.language_version }}Seeds{{ data.seeds }}
+
+ +
+ + + + + + + + + + + + + + + + {% include "partials/table_report.html" %} - -
DatasetSamplesFeaturesClasses{{ app_config.nodes }}{{ app_config.leaves }}{{ app_config.depth }}{{ data.score_name|capitalize }}Timehyperparameters
- {% if summary|length > 0 %} + + + {% if summary|length > 0 %}
@@ -76,12 +84,19 @@ {% include "partials/table_summary.html" %}
- {% endif %} - - - Total score: {{ "%.6f" % (data.results | sum(attribute="score")) }} - - Number of files: {{ data.results | length }} -
+ {% endif %} + + + + Total score: {{ "%.6f" % (data.results | sum(attribute="score") ) }} + + + + Number of files: {{ data.results | length }} + +
-
\ No newline at end of file + diff --git a/benchmark/scripts/app/templates/partials/table_report_bulma.html b/benchmark/scripts/app/templates/partials/table_report_bulma.html index 86859e7..07e87db 100644 --- a/benchmark/scripts/app/templates/partials/table_report_bulma.html +++ b/benchmark/scripts/app/templates/partials/table_report_bulma.html @@ -1,75 +1,80 @@
-
-
-
-
- -

{{ data.title }}

-
+
+
+
+
+ +

{{ data.title }}

-
-
-
-
- - - - - - - - {% if data.duration > 7200 %} + + +
+
+
+
PlatformModelDateTime
+ + + + + + + {% if data.duration > 7200 %} {% set unit = "h" %} {% set divider = 3600 %} - {% else %} + {% else %} {% set unit = "min" %} {% set divider = 60 %} - {% endif %} - - - - - - - - - - - - - - - - - - - - - - -
PlatformModelDateTimeDuration ({{ unit }})StratifiedDiscretized# Folds
{{ data.platform }}{{ data.model }} {{ data.version }}{{ data.date}}{{ data.time}}{{ "%.2f" % (data.duration/divider) }}{{ data.stratified }}{{ data.discretized }}{{ data.folds }}
Language{{ data.language }} {{ data.language_version }}Seeds{{ data.seeds }}
-
- -
- - - - - - - - - - - - - - - {% include "partials/table_report.html" %} - -
DatasetSamplesFeaturesClassesNodes{{data.score_name|capitalize}}Timehyperparameters
- {% if summary|length > 0 %} + {% endif %} + Duration ({{ unit }}) + Stratified + Discretized + # Folds + + + {{ data.platform }} + {{ data.model }} {{ data.version }} + {{ data.date }} + {{ data.time }} + {{ "%.2f" % (data.duration/divider) }} + {{ data.stratified }} + {{ data.discretized }} + {{ data.folds }} + + + Language + {{ data.language }} {{ data.language_version }} + Seeds + {{ data.seeds }} + + + +
+ +
+ + + + + + + + + + + + + + + + + {% include "partials/table_report.html" %} + +
DatasetSamplesFeaturesClasses{{ app_config.nodes }}{{ app_config.leaves }}{{ app_config.depth }}{{ data.score_name|capitalize }}Timehyperparameters
+ {% if summary|length > 0 %}
@@ -82,12 +87,14 @@ {% include "partials/table_summary.html" %}
- {% endif %} -

- - Total score: {{ "%.6f" % (data.results | sum(attribute="score")) }} -

-

Number of files: {{ data.results | length }}

-
+ {% endif %} +

+ + + Total score: {{ "%.6f" % (data.results | sum(attribute="score") ) }} + +

+

Number of files: {{ data.results | length }}

+
-
\ No newline at end of file +