Fix Excel files

This commit is contained in:
2023-06-06 17:25:47 +02:00
parent 8e29948809
commit 8c576f8f2c
19 changed files with 182 additions and 339 deletions

View File

@@ -1,4 +1,4 @@
<table id="file-table"
<table id="report-table"
class="table table-striped table-hover table-bordered bg-light">
<thead>
<tr class="bg-primary text-white">

View File

@@ -1,4 +1,15 @@
{% from "macros.html" import excel_button %}
<div id="app">
{% if back %}
<button type="button"
class="btn btn-primary position-relative"
onclick="location.href='{{ back }}'">
Back to Best Results Report
<span class="position-absolute top-0 start-100 translate-middle p-2 bg-danger border border-light rounded-circle">
<span class="visually-hidden">Back to Best Results Report</span>
</span>
</button>
{% endif %}
<section class="section">
<div class="container-fluid">
<div>
@@ -39,11 +50,7 @@
</tr>
</thead>
</table>
<div>
<button class="{{ button }}" onclick="excelFile()">
<i class="mdi mdi-file-excel"></i> Excel
</button>
</div>
<div>{{ excel_button([ file ]) }}</div>
<table id="report-table"
class="table table-striped table-hover table-bordered bg-light">
<thead>
@@ -53,7 +60,7 @@
<th class="text-center">Features</th>
<th class="text-center">Classes</th>
<th class="text-center">Nodes</th>
<th class="text-center">{{ data.score_name|capitalize }}</th>
<th class="text-center" colspan="2">{{ data.score_name|capitalize }}</th>
<th class="text-center">Time</th>
<th class="text-center">hyperparameters</th>
</tr>
@@ -62,13 +69,14 @@
{% for item in data.results %}
<tr>
<td>{{ item.dataset }}</td>
<td class="{{ right }}">{{ '{:,}'.format(item.samples) }}</td>
<td class="{{ right }}">{{"%d" % item.features}}</td>
<td class="{{ right }}">{{"%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>
<td class="text-end">{{ '{:,}'.format(item.samples) }}</td>
<td class="text-end">{{"%d" % item.features}}</td>
<td class="text-end">{{"%d" % item.classes}}</td>
<td class="text-end">{{ '{:,.2f}'.format(item.nodes) }}</td>
<td class="text-end">{{"%.6f±%.4f" % (item.score, item.score_std)}}</td>
<td class="text-center">{{ item.symbol|safe }}</td>
<td class="text-end">{{"%.6f±%.4f" % (item.time, item.time_std)}}</td>
<td class="text-center">{{ item.hyperparameters }}</td>
</tr>
{% endfor %}
</tbody>
@@ -86,11 +94,9 @@
<tbody>
{% for key, value in summary.items() %}
<tr>
<td class="{{ center }}">{{ key }}</td>
<td class="text-center">{{ key }}</td>
<td>{{ value[0] }}</td>
<td class={{ right }}>
{{ '{:,}'.format(value[1]) }}
</td>
<td class=text-end>{{ '{:,}'.format(value[1]) }}</td>
</tr>
</tbody>
{% endfor %}

View File

@@ -1,6 +1,10 @@
<div class="float-right">
<input type="checkbox" id="compare" name="compare" {% if config["COMPARE"] %}{{ "checked" }}{% endif %}>
<span class="badge bg-info bg-small" onclick="$('#compare').click()">Comparing with best results</span>
{% from "macros.html" import excel_button %}
<div class="d-flex justify-content-between">
{{ excel_button('', 'excel_select') }}
<div>
<input type="checkbox" id="compare" name="compare" {% if config["COMPARE"] %}{{ "checked" }}{% endif %}>
<span class="badge bg-info bg-small" onclick="$('#compare').click()">Comparing with best results</span>
</div>
</div>
<table id="file-table"
class="table table-striped table-hover table-bordered">

View File

@@ -1,29 +1,32 @@
{% extends "base.html" %}
{% block content %}
<table id="report-table"
class="table table-striped table-hover table-bordered bg-light">
<thead>
<tr class="bg-primary text-white">
<th class="text-center">Dataset</th>
<th class="text-center">Score</th>
<th class="text-center">Hyperparameters</th>
<th class="text-center">File</th>
</tr>
</thead>
<tbody>
{% for dataset, info in data.items() %}
<tr>
<td>{{ dataset }}</td>
<td class="text-end">{{ '%9.7f' % info[0] }}</td>
<td class="text-center">{{ info[1] }}</td>
<td>
{% set url = url_for(request.endpoint, **request.view_args)|urlencode %}
<a href="{{ url_for('results.report', file_name = info[2]) }}?url={{ url }}">{{ info[2] }}</a>
</td>
<div class="alert alert-primary" role="alert">
<h3>{{ title }}</h3>
<table id="report-table"
class="table table-striped table-hover table-bordered bg-light">
<thead>
<tr class="bg-primary text-white">
<th class="text-center">Dataset</th>
<th class="text-center">Score</th>
<th class="text-center">Hyperparameters</th>
<th class="text-center">File</th>
</tr>
{% endfor %}
</tbody>
</table>
</thead>
<tbody>
{% for dataset, info in data.items() %}
<tr>
<td>{{ dataset }}</td>
<td class="text-end">{{ '%9.7f' % info[0] }}</td>
<td class="text-center">{{ info[1] }}</td>
<td>
{% set url = url_for(request.endpoint, **request.view_args)|urlencode %}
<a href="{{ url_for('results.report', file_name = info[2]) }}?url={{ url }}">{{ info[2] }}</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}
{% block jscript %}
{{ super() }}

View File

@@ -1,26 +1,11 @@
{% from "macros.html" import excel_button %}
{% extends "base.html" %}
{% block content %}
{{ excel_button(["datasets"]) }}
{% include "_table_datasets.html" %}
{% endblock %}
{% block jscript %}
{{ super() }}
<script>
$(document).ready(function () {
$(document).ajaxStart(function(){
$("body").addClass('ajaxLoading');
});
$(document).ajaxStop(function(){
$("body").removeClass('ajaxLoading');
});
});
// Check if row is selected
$('#file-table tbody').on('click', 'tr', function () {
if ($(this).hasClass('selected')) {
$(this).removeClass('selected');
} else {
$('#file-table tbody tr.selected').removeClass("selected")
$(this).addClass('selected');
}
});
</script>
<script src="{{ url_for('static', filename="js/report.js") }}"></script>
<script src="{{ url_for('static', filename="js/excelFiles.js") }}"></script>
{% endblock %}

View File

@@ -0,0 +1,12 @@
{% macro excel_button(files, function="excelSend") %}
{% if files %}
{% set call %}
{{ function }}({{ files }})
{% endset %}
{% else %}
{% set call = function + "()" %}
{% endif %}
<button class="btn btn-primary btn-small" onclick="{{ call }}">
<i class="mdi mdi-file-excel"></i> Excel
</button>
{% endmacro %}

View File

@@ -5,4 +5,5 @@
{% block jscript %}
{{ super() }}
<script src="{{ url_for('static', filename="js/report.js") }}"></script>
<script src="{{ url_for('static', filename="js/excelFiles.js") }}"></script>
{% endblock %}

View File

@@ -13,4 +13,5 @@
<script rel="stylesheet"
href="https://cdn.datatables.net/1.13.4/js/dataTables.bootstrap5.min.js"></script>
<script src="{{ url_for('static', filename="js/select.js") }}"></script>
<script src="{{ url_for('static', filename="js/excelFiles.js") }}"></script>
{% endblock %}