Change partials criteria

This commit is contained in:
2023-05-28 03:12:12 +02:00
parent 219b626061
commit 3928b9c583
11 changed files with 302 additions and 349 deletions

View File

@@ -39,9 +39,10 @@ def index():
candidate = app.config[FRAMEWORKS].copy() candidate = app.config[FRAMEWORKS].copy()
candidate.remove(app.config[FRAMEWORK]) candidate.remove(app.config[FRAMEWORK])
return render_template( return render_template(
f"select_{app.config[FRAMEWORK]}.html", f"select.html",
files=files, files=files,
framework=candidate[0], framework=candidate[0],
used_framework=app.config[FRAMEWORK],
) )
@@ -52,7 +53,10 @@ def show():
data = json.load(f) data = json.load(f)
summary = process_data(selected_file, data) summary = process_data(selected_file, data)
return render_template( return render_template(
f"report_{app.config[FRAMEWORK]}.html", data=data, summary=summary f"report.html",
data=data,
summary=summary,
used_framework=app.config[FRAMEWORK],
) )

View File

@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<title>{{ title }}</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.min.css">
<style>
body {
font-family: Courier;
}
#file-table tbody tr.selected td{
background-color: #0dcaf0;
color:white;
}
</style>
</head>
<body>
{% block content %}
{% endblock %}
</body>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.min.js" integrity="sha384-cuYeSxntonz0PPNlHhBs68uyIAVpIIOZZ5JqeqvYYIcEL727kskC66kF92t6Xl2V"
crossorigin="anonymous"></script>
</html>

View File

@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<title>{{ title }}</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.min.css">
<style>
body {
font-family: Courier;
}
.tag {
cursor: pointer;
}
</style>
</head>
<body>
{% block content %}
{% endblock %}
</body>
</html>

View File

@@ -0,0 +1,30 @@
<script>
$(document).ready(function () {
var table = $('#file-table').DataTable({
"paging": true,
"searching": true,
"ordering": true,
"info": true,
"select.items": "row",
"columnDefs": [{
"targets": 6,
"orderable": false
}]
});
$('#file-table tbody').on('click', 'tr', function () {
if ($(this).hasClass('{{ selected }}')) {
$(this).removeClass('{{ selected }}');
} else {
table.$('tr.{{ selected }}').removeClass('{{ selected }}');
$(this).addClass('{{ selected }}');
}
});
});
function showFile(selectedFile) {
var form = $('<form action="/show" method="post">' +
'<input type="hidden" name="selected-file" value="' + selectedFile + '" />' +
'</form>');
$('body').append(form);
form.submit();
}
</script>

View File

@@ -0,0 +1,11 @@
<div class="container">
<h1 class="{{ h1_class }}"><b>Benchmark Results</b></h1>
<button class="{{ button_class }}" onclick="location.href='/config/{{ framework }}';">Use {{ framework
}}</button>
{% include "partials/table_select.html" %}
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
{% include "partials/js_select.html" %}

View File

@@ -0,0 +1,187 @@
{% set title = "Report Viewer" %}
{% if used_framework == "bootstrap" %}
{% extends "base_bootstrap.html" %}
{% else %}
{% extends "base_bulma.html" %}
{% endif%}
{% block content%}
{% if used_framework == "bootstrap" %}
{% set center = "text-center" %}
{% set right = "text-end" %}
<div id="app">
<section class="section">
<div class="container">
<div class="p-4 bg-primary text-white">
<button type="button" class="btn-close" aria-label="Close" onclick="location.href='/index';"></button>
<h1>{{ data.title }}</h1>
</div>
<div>
<table class="table table-bordered">
<thead>
<tr class="bg-info text-white">
<th class="text-center">Platform</th>
<th class="text-center">Model</th>
<th class="text-center">Date</th>
<th class="text-center">Time</th>
{% if data.duration > 7200 %}
{% set unit = "h" %}
{% set divider = 3600 %}
{% else %}
{% set unit = "min" %}
{% set divider = 60 %}
{% endif %}
<th class="text-center">Duration ({{ unit }})</th>
<th class="text-center">Stratified</th>
<th class="text-center">Discretized</th>
<th class="text-center"># Folds</th>
</tr>
<tr>
<th class="text-center">{{ data.platform }}</th>
<th class="text-center">{{ data.model }} {{ data.version }}</th>
<th class="text-center">{{ data.date}}</th>
<th class="text-center">{{ data.time}}</th>
<th class="text-center">{{ "%.2f" % (data.duration/divider) }}</th>
<th class="text-center">{{ data.stratified }}</th>
<th class="text-center">{{ data.discretized }}</th>
<th class="text-center">{{ data.folds }}</th>
</tr>
<tr>
<th class="text-center bg-info text-white">Language</th>
<th class="text-center" colspan=3>{{ data.language }} {{ data.language_version }}</th>
<th class="text-center bg-info text-white">Seeds</th>
<th class="text-center" colspan=6>{{ data.seeds }}</th>
</tr>
</thead>
</table>
<table class="table table-striped table-hover table-bordered">
<thead>
<tr class="bg-primary text-white">
<th class="text-center">Dataset</th>
<th class="text-center">Samples</th>
<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">Time</th>
<th class="text-center">hyperparameters</th>
</tr>
</thead>
<tbody>
{% include "partials/table_report.html" %}
</tbody>
</table>
{% if summary|length > 0 %}
<div class="col-4 col-lg-4">
<table class="table table-bordered">
<thead>
<tr>
<th class="text-center bg-primary text-white">Symbol</th>
<th class="text-center bg-primary text-white">Meaning</th>
<th class="text-center bg-primary text-white">Count</th>
</tr>
</thead>
{% include "partials/table_summary.html" %}
</table>
</div>
{% endif %}
<button type="button" class="btn-close" aria-label="Close" onclick="location.href='/index';"></button>
<h7><b>
Total score: {{ "%.6f" % (data.results | sum(attribute="score")) }}
</b></h7>
</div>
</section>
</div>
{% else %}
{% set center = "has-text-centered" %}
{% set right = "has-text-right" %}
<div id="app">
<header>
<div class="container">
<div class="hero is-info is-bold">
<div class="hero-body">
<button class="delete is-large" onclick="location.href='/index';"></button>
<h1 class="is-size-3">{{ data.title }}</h1>
</div>
</div>
</div>
</header>
<section class="section">
<div class="container">
<div>
<table class="table is-fullwidth is-striped is-bordered">
<thead>
<tr class="is-selected">
<th class="has-text-centered">Platform</th>
<th class="has-text-centered">Model</th>
<th class="has-text-centered">Date</th>
<th class="has-text-centered">Time</th>
{% if data.duration > 7200 %}
{% set unit = "h" %}
{% set divider = 3600 %}
{% else %}
{% set unit = "min" %}
{% set divider = 60 %}
{% endif %}
<th class="has-text-centered">Duration ({{ unit }})</th>
<th class="has-text-centered">Stratified</th>
<th class="has-text-centered">Discretized</th>
<th class="has-text-centered"># Folds</th>
</tr>
<tr>
<th class="has-text-centered">{{ data.platform }}</th>
<th class="has-text-centered">{{ data.model }} {{ data.version }}</th>
<th class="has-text-centered">{{ data.date}}</th>
<th class="has-text-centered">{{ data.time}}</th>
<th class="has-text-centered">{{ "%.2f" % (data.duration/divider) }}</th>
<th class="has-text-centered">{{ data.stratified }}</th>
<th class="has-text-centered">{{ data.discretized }}</th>
<th class="has-text-centered">{{ data.folds }}</th>
</tr>
<tr>
<th class="has-text-center is-selected">Language</th>
<th class="has-text-centered" colspan=3>{{ data.language }} {{ data.language_version }}</th>
<th class="has-text-centered is-selected">Seeds</th>
<th class="has-text-centered" colspan=6>{{ data.seeds }}</th>
</tr>
</thead>
</table>
<table class="table is-fullwidth is-striped is-hoverable is-bordered">
<thead>
<tr class="is-selected">
<th class="has-text-centered">Dataset</th>
<th class="has-text-centered">Samples</th>
<th class="has-text-centered">Features</th>
<th class="has-text-centered">Classes</th>
<th class="has-text-centered">Nodes</th>
<th class="has-text-centered">{{data.score_name|capitalize}}</th>
<th class="has-text-centered">Time</th>
<th class="has-text-centered">hyperparameters</th>
</tr>
</thead>
<tbody>
{% include "partials/table_report.html" %}
</tbody>
</table>
{% if summary|length > 0 %}
<div class="col-2 col-lg-2">
<table class="table is-bordered">
<thead>
<tr class="is-selected">
<th class="has-text-centered">Symbol</th>
<th class="has-text-centered">Meaning</th>
<th class="has-text-centered">Count</th>
</tr>
</thead>
{% include "partials/table_summary.html" %}
</table>
</div>
{% endif %}
<h2 class="has-text-white has-background-primary"><b>
<button class="delete" onclick="location.href='/index';"></button>
Total score: {{ "%.6f" % (data.results | sum(attribute="score")) }}
</b></h2>
</div>
</section>
</div>
{% endif %}
{% endblock %}

View File

@@ -1,105 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<title>Report Viewer</title>
<style>
body {
font-family: Courier;
}
</style>
</head>
<body>
{% set center = "text-center" %}
{% set right = "text-end" %}
<div id="app">
<section class="section">
<div class="container">
<div class="p-4 bg-primary text-white">
<button type="button" class="btn-close" aria-label="Close" onclick="location.href='/index';"></button>
<h1>{{ data.title }}</h1>
</div>
<div>
<table class="table table-bordered">
<thead>
<tr class="bg-info text-white">
<th class="text-center">Platform</th>
<th class="text-center">Model</th>
<th class="text-center">Date</th>
<th class="text-center">Time</th>
{% if data.duration > 7200 %}
{% set unit = "h" %}
{% set divider = 3600 %}
{% else %}
{% set unit = "min" %}
{% set divider = 60 %}
{% endif %}
<th class="text-center">Duration ({{ unit }})</th>
<th class="text-center">Stratified</th>
<th class="text-center">Discretized</th>
<th class="text-center"># Folds</th>
</tr>
<tr>
<th class="text-center">{{ data.platform }}</th>
<th class="text-center">{{ data.model }} {{ data.version }}</th>
<th class="text-center">{{ data.date}}</th>
<th class="text-center">{{ data.time}}</th>
<th class="text-center">{{ "%.2f" % (data.duration/divider) }}</th>
<th class="text-center">{{ data.stratified }}</th>
<th class="text-center">{{ data.discretized }}</th>
<th class="text-center">{{ data.folds }}</th>
</tr>
<tr>
<th class="text-center bg-info text-white">Language</th>
<th class="text-center" colspan=3>{{ data.language }} {{ data.language_version }}</th>
<th class="text-center bg-info text-white">Seeds</th>
<th class="text-center" colspan=6>{{ data.seeds }}</th>
</tr>
</thead>
</table>
<table class="table table-striped table-hover table-bordered">
<thead>
<tr class="bg-primary text-white">
<th class="text-center">Dataset</th>
<th class="text-center">Samples</th>
<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">Time</th>
<th class="text-center">hyperparameters</th>
</tr>
</thead>
<tbody>
{% include "partials/table_report.html" %}
</tbody>
</table>
{% if summary|length > 0 %}
<div class="col-4 col-lg-4">
<table class="table table-bordered">
<thead>
<tr>
<th class="text-center bg-primary text-white">Symbol</th>
<th class="text-center bg-primary text-white">Meaning</th>
<th class="text-center bg-primary text-white">Count</th>
</tr>
</thead>
{% include "partials/table_summary.html" %}
</table>
</div>
{% endif %}
<button type="button" class="btn-close" aria-label="Close" onclick="location.href='/index';"></button>
<h7><b>
Total score: {{ "%.6f" % (data.results | sum(attribute="score")) }}
</b></h7>
</div>
</section>
</div>
</body>
</html>

View File

@@ -1,110 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.1/css/bulma.min.css">
<title>Report Viewer</title>
<style>
body {
font-family: Courier;
}
</style>
</head>
<body>
{% set center = "has-text-centered" %}
{% set right = "has-text-right" %}
<div id="app">
<header>
<div class="container">
<div class="hero is-info is-bold">
<div class="hero-body">
<button class="delete is-large" onclick="location.href='/index';"></button>
<h1 class="is-size-3">{{ data.title }}</h1>
</div>
</div>
</div>
</header>
<section class="section">
<div class="container">
<div>
<table class="table is-fullwidth is-striped is-bordered">
<thead>
<tr class="is-selected">
<th class="has-text-centered">Platform</th>
<th class="has-text-centered">Model</th>
<th class="has-text-centered">Date</th>
<th class="has-text-centered">Time</th>
{% if data.duration > 7200 %}
{% set unit = "h" %}
{% set divider = 3600 %}
{% else %}
{% set unit = "min" %}
{% set divider = 60 %}
{% endif %}
<th class="has-text-centered">Duration ({{ unit }})</th>
<th class="has-text-centered">Stratified</th>
<th class="has-text-centered">Discretized</th>
<th class="has-text-centered"># Folds</th>
</tr>
<tr>
<th class="has-text-centered">{{ data.platform }}</th>
<th class="has-text-centered">{{ data.model }} {{ data.version }}</th>
<th class="has-text-centered">{{ data.date}}</th>
<th class="has-text-centered">{{ data.time}}</th>
<th class="has-text-centered">{{ "%.2f" % (data.duration/divider) }}</th>
<th class="has-text-centered">{{ data.stratified }}</th>
<th class="has-text-centered">{{ data.discretized }}</th>
<th class="has-text-centered">{{ data.folds }}</th>
</tr>
<tr>
<th class="has-text-center is-selected">Language</th>
<th class="has-text-centered" colspan=3>{{ data.language }} {{ data.language_version }}</th>
<th class="has-text-centered is-selected">Seeds</th>
<th class="has-text-centered" colspan=6>{{ data.seeds }}</th>
</tr>
</thead>
</table>
<table class="table is-fullwidth is-striped is-hoverable is-bordered">
<thead>
<tr class="is-selected">
<th class="has-text-centered">Dataset</th>
<th class="has-text-centered">Samples</th>
<th class="has-text-centered">Features</th>
<th class="has-text-centered">Classes</th>
<th class="has-text-centered">Nodes</th>
<th class="has-text-centered">{{data.score_name|capitalize}}</th>
<th class="has-text-centered">Time</th>
<th class="has-text-centered">hyperparameters</th>
</tr>
</thead>
<tbody>
{% include "partials/table_report.html" %}
</tbody>
</table>
{% if summary|length > 0 %}
<div class="col-2 col-lg-2">
<table class="table is-bordered">
<thead>
<tr class="is-selected">
<th class="has-text-centered">Symbol</th>
<th class="has-text-centered">Meaning</th>
<th class="has-text-centered">Count</th>
</tr>
</thead>
{% include "partials/table_summary.html" %}
</table>
</div>
{% endif %}
<h2 class="has-text-white has-background-primary"><b>
<button class="delete" onclick="location.href='/index';"></button>
Total score: {{ "%.6f" % (data.results | sum(attribute="score")) }}
</b></h2>
</div>
</section>
</div>
</body>
</html>

View File

@@ -0,0 +1,22 @@
{% set title = "Benchmark Results" %}
{% if used_framework == "bootstrap" %}
{% extends "base_bootstrap.html" %}
{% set button_class = "btn btn-primary bt-sm" %}
{% set h1_class = "text-center" %}
{% set table_class = "table table-striped table-hover" %}
{% set button_pre = '<button class="btn btn-primary btn-sm"
style="--bs-btn-padding-y: .25rem; --bs-btn-padding-x: .5rem; --bs-btn-font-size: .75rem;"
onclick="showFile(\''%}
{% set button_post = '\')">View</button>' %}
{% else %}
{% extends "base_bulma.html" %}
{% set button_class = "button is-primary is-small" %}
{% set h1_class = "title is-1 has-text-centered" %}
{% set table_class = "table is-striped is-hoverable cell-border" %}
{% set button_pre = '<span class="tag is-link is-normal" type="button" onclick="showFile(\'' %}
{% set button_post = '\')">View</span>' %}
{% set selected = "is-selected" %}
{% endif %}
{% block content %}
{% include "partials/table_select_design.html" %}
{% endblock %}

View File

@@ -1,69 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Benchmark</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.min.css">
<style>
body {
font-family: Courier;
}
#file-table tbody tr.selected td{
background-color: #0dcaf0;
color:white;
}
</style>
</head>
<body>
<div class="container">
<h1 class="text-center"><b>Benchmark Results</b></h1>
<button class="btn btn-primary btn-sm" onclick="location.href='/config/{{ framework }}';">Use {{ framework
}}</button>
{% set table_class = "table table-striped table-hover" %}
{% set button_pre = '<button class="btn btn-primary btn-sm"
style="--bs-btn-padding-y: .25rem; --bs-btn-padding-x: .5rem; --bs-btn-font-size: .75rem;"
onclick="showFile(\''%}
{% set button_post = '\')">View
</button>' %}
{% include "partials/table_select.html" %}
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.min.js" integrity="sha384-cuYeSxntonz0PPNlHhBs68uyIAVpIIOZZ5JqeqvYYIcEL727kskC66kF92t6Xl2V"
crossorigin="anonymous"></script>
<script>
$(document).ready(function () {
var table = $('#file-table').DataTable({
"paging": true,
"searching": true,
"ordering": true,
"info": true,
"columnDefs": [{
"targets": 6,
"orderable": false
}]
});
$('#file-table tbody').on('click', 'tr', function () {
if ($(this).hasClass('selected')) {
$(this).removeClass('selected');
} else {
table.$('tr.selected').removeClass('selected');
$(this).addClass('selected');
}
});
});
function showFile(selectedFile) {
var form = $('<form action="/show" method="post">' +
'<input type="hidden" name="selected-file" value="' + selectedFile + '" />' +
'</form>');
$('body').append(form);
form.submit();
}
</script>
</body>
</html>

View File

@@ -1,63 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Benchmark Results</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.min.css">
<style>
body {
font-family: Courier;
}
.tag {
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<h1 class="title is-1 has-text-centered">Benchmark Results</h1>
<button class="button is-primary is-small" onclick="location.href='/config/{{ framework }}';">Use {{ framework
}}</button>
{% set table_class = "table is-striped is-hoverable cell-border" %}
{% set button_pre = '<span class="tag is-link is-normal" type="button" onclick="showFile(\'' %}
{% set button_post = '\')">View</span>' %}
{% include "partials/table_select.html" %}
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
<script>
$(document).ready(function () {
var table = $('#file-table').DataTable({
"paging": true,
"searching": true,
"ordering": true,
"info": true,
"select.items": "row",
"columnDefs": [{
"targets": 6,
"orderable": false
}]
});
$('#file-table tbody').on('click', 'tr', function () {
if ($(this).hasClass('is-selected')) {
$(this).removeClass('is-selected');
} else {
table.$('tr.is-selected').removeClass('is-selected');
$(this).addClass('is-selected');
}
});
});
function showFile(selectedFile) {
var form = $('<form action="/show" method="post">' +
'<input type="hidden" name="selected-file" value="' + selectedFile + '" />' +
'</form>');
$('body').append(form);
form.submit();
}
</script>
</body>
</html>