Update format to report

This commit is contained in:
2023-06-26 11:07:12 +02:00
parent 4b17cc2230
commit 6844d13973
4 changed files with 177 additions and 167 deletions

View File

@@ -3,6 +3,7 @@ import os
import json import json
import shutil import shutil
import xlsxwriter import xlsxwriter
from dotenv import dotenv_values
from benchmark.Utils import Files, Folders from benchmark.Utils import Files, Folders
from benchmark.Arguments import EnvData from benchmark.Arguments import EnvData
from benchmark.ResultsBase import StubReport from benchmark.ResultsBase import StubReport
@@ -99,7 +100,7 @@ def datasets(compare):
def showfile(file_name, compare, back=None): def showfile(file_name, compare, back=None):
compare = compare.capitalize() == "True" compare = compare.capitalize() == "True"
back = request.args["url"] if back is None else back 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: with open(os.path.join(Folders.results, file_name)) as f:
data = json.load(f) data = json.load(f)
try: try:
@@ -113,6 +114,7 @@ def showfile(file_name, compare, back=None):
summary=summary, summary=summary,
framework=current_app.config[FRAMEWORK], framework=current_app.config[FRAMEWORK],
back=back, back=back,
app_config=app_config,
) )

View File

@@ -1,28 +1,14 @@
{% for item in data.results %} {% for item in data.results %}
<tr> <tr>
<td> <td>{{ item.dataset }}</td>
{{item.dataset}} <td class="{{ right }}">{{ '{:,}'.format(item.samples) }}</td>
</td> <td class="{{ right }}">{{"%d" % item.features}}</td>
<td class="{{ right }}"> <td class="{{ right }}">{{"%d" % item.classes}}</td>
{{'{:,}'.format(item.samples)}} <td class="{{ right }}">{{ '{:,.2f}'.format(item.nodes|float) }}</td>
</td> <td class="{{ right }}">{{ '{:,.2f}'.format(item.leaves|float) }}</td>
<td class="{{ right }}"> <td class="{{ right }}">{{ '{:,.2f}'.format(item.depth|float) }}</td>
{{"%d" % item.features}} <td class="{{ right }}">{{"%.6f±%.4f" % (item.score, item.score_std)}} {{ item.symbol|safe }}</td>
</td> <td class="{{ right }}">{{"%.6f±%.4f" % (item.time, item.time_std)}}</td>
<td class="{{ right }}"> <td class="{{ center }}">{{ item.hyperparameters }}</td>
{{"%d" % item.classes}}
</td>
<td class="{{ right }}">
{{'{:,.2f}'.format(item.nodes)}}
</td>
<td class="{{ right }}">
{{"%.6f±%.4f" % (item.score, item.score_std)}} {{ item.symbol|safe }}
</td>
<td class="{{ right }}">
{{"%.6f±%.4f" % (item.time, item.time_std)}}
</td>
<td class="{{ center }}">
{{item.hyperparameters}}
</td>
</tr> </tr>
{% endfor %} {% endfor %}

View File

@@ -2,7 +2,10 @@
<section class="section"> <section class="section">
<div class="container-fluid"> <div class="container-fluid">
<div class="p-4 bg-primary text-white"> <div class="p-4 bg-primary text-white">
<button type="button" class="btn-close" aria-label="Close" onclick="location.href = '{{back}}'"></button> <button type="button"
class="btn-close"
aria-label="Close"
onclick="location.href = '{{ back }}'"></button>
<h1>{{ data.title }}</h1> <h1>{{ data.title }}</h1>
</div> </div>
<div> <div>
@@ -44,16 +47,21 @@
</thead> </thead>
</table> </table>
<div> <div>
<button class="{{ button }}" onclick="excelFile()"><i class="mdi mdi-file-excel"></i> Excel</button> <button class="{{ button }}" onclick="excelFile()">
<i class="mdi mdi-file-excel"></i> Excel
</button>
</div> </div>
<table id="report-table" class="table table-striped table-hover table-bordered"> <table id="report-table"
class="table table-striped table-hover table-bordered">
<thead> <thead>
<tr class="bg-primary text-white"> <tr class="bg-primary text-white">
<th class="text-center">Dataset</th> <th class="text-center">Dataset</th>
<th class="text-center">Samples</th> <th class="text-center">Samples</th>
<th class="text-center">Features</th> <th class="text-center">Features</th>
<th class="text-center">Classes</th> <th class="text-center">Classes</th>
<th class="text-center">Nodes</th> <th class="text-center">{{ app_config.nodes }}</th>
<th class="text-center">{{ app_config.leaves }}</th>
<th class="text-center">{{ app_config.depth }}</th>
<th class="text-center">{{ data.score_name|capitalize }}</th> <th class="text-center">{{ data.score_name|capitalize }}</th>
<th class="text-center">Time</th> <th class="text-center">Time</th>
<th class="text-center">hyperparameters</th> <th class="text-center">hyperparameters</th>
@@ -77,11 +85,18 @@
</table> </table>
</div> </div>
{% endif %} {% endif %}
<button type="button" class="btn-close" aria-label="Close" onclick="location.href = '/index/{{ compare }}'"></button> <button type="button"
<h7><b> class="btn-close"
aria-label="Close"
onclick="location.href = '/index/{{ compare }}'"></button>
<h7>
<b>
Total score: {{ "%.6f" % (data.results | sum(attribute="score") ) }} Total score: {{ "%.6f" % (data.results | sum(attribute="score") ) }}
</b></h7> </b>
<h7>Number of files: {{ data.results | length }}</h7> </h7>
<h7>
Number of files: {{ data.results | length }}
</h7>
</div> </div>
</section> </section>
</div> </div>

View File

@@ -50,16 +50,21 @@
</thead> </thead>
</table> </table>
<div> <div>
<button class="{{ button }}" onclick="excelFile()"><i class="mdi mdi-file-excel"></i> Excel</button> <button class="{{ button }}" onclick="excelFile()">
<i class="mdi mdi-file-excel"></i> Excel
</button>
</div> </div>
<table id="report-table" class="table is-fullwidth is-striped is-hoverable is-bordered"> <table id="report-table"
class="table is-fullwidth is-striped is-hoverable is-bordered">
<thead> <thead>
<tr class="is-selected"> <tr class="is-selected">
<th class="has-text-centered">Dataset</th> <th class="has-text-centered">Dataset</th>
<th class="has-text-centered">Samples</th> <th class="has-text-centered">Samples</th>
<th class="has-text-centered">Features</th> <th class="has-text-centered">Features</th>
<th class="has-text-centered">Classes</th> <th class="has-text-centered">Classes</th>
<th class="has-text-centered">Nodes</th> <th class="has-text-centered">{{ app_config.nodes }}</th>
<th class="has-text-centered">{{ app_config.leaves }}</th>
<th class="has-text-centered">{{ app_config.depth }}</th>
<th class="has-text-centered">{{ data.score_name|capitalize }}</th> <th class="has-text-centered">{{ data.score_name|capitalize }}</th>
<th class="has-text-centered">Time</th> <th class="has-text-centered">Time</th>
<th class="has-text-centered">hyperparameters</th> <th class="has-text-centered">hyperparameters</th>
@@ -83,10 +88,12 @@
</table> </table>
</div> </div>
{% endif %} {% endif %}
<h2 class="has-text-white has-background-primary"><b> <h2 class="has-text-white has-background-primary">
<b>
<button class="delete" onclick="location.href = '/index/{{ compare }}'"></button> <button class="delete" onclick="location.href = '/index/{{ compare }}'"></button>
Total score: {{ "%.6f" % (data.results | sum(attribute="score") ) }} Total score: {{ "%.6f" % (data.results | sum(attribute="score") ) }}
</b></h2> </b>
</h2>
<h2>Number of files: {{ data.results | length }}</h2> <h2>Number of files: {{ data.results | length }}</h2>
</div> </div>
</section> </section>