diff --git a/app/app.db b/app/app.db index 8132068..fe7a75a 100644 Binary files a/app/app.db and b/app/app.db differ diff --git a/app/config.py b/app/config.py index 7de7c2e..027805f 100644 --- a/app/config.py +++ b/app/config.py @@ -17,10 +17,3 @@ class Config(object): "DATABASE_URL" ) or "sqlite:///" + os.path.join(basedir, "app.db") SQLALCHEMY_TRACK_MODIFICATIONS = False - - @staticmethod - def save(): - with open(dotenv_file, "w") as f: - f.write("FRAMEWORK=" + Config.FRAMEWORK + "\n") - f.write("OUTPUT=" + Config.OUTPUT + "\n") - f.write("COMPARE=" + str(Config.COMPARE) + "\n") diff --git a/app/results/main_select.py b/app/results/main_select.py index f5b9933..eacb9b1 100644 --- a/app/results/main_select.py +++ b/app/results/main_select.py @@ -7,6 +7,7 @@ from flask_login import current_user from flask import Blueprint, current_app, send_file from flask import render_template, current_app, request, redirect, url_for from flask_login import login_required +from ..config import Config # import shutil # import xlsxwriter @@ -15,6 +16,25 @@ from flask_login import login_required results = Blueprint("results", __name__, template_folder="templates") +class AjaxResponse: + def __init__(self, success, file_name, code=200): + self.success = success + self.file_name = file_name + self.code = code + + def to_string(self): + return ( + json.dumps( + { + "success": self.success, + "file": self.file_name, + } + ), + self.code, + {"ContentType": "application/json"}, + ) + + @results.route("/select") @login_required def select(compare="False"): @@ -63,6 +83,13 @@ def best(file_name): return render_template("datasets.html", datasets=datos) +@results.route("/set_compare", methods=["POST"]) +def set_compare(): + compare = request.json["compare"] + current_app.config.update(COMPARE=compare) + return AjaxResponse(True, "Ok").to_string() + + @results.route("/report/") @login_required def report(file_name): @@ -70,17 +97,14 @@ def report(file_name): with open(os.path.join(Folders.results, file_name)) as f: data = json.load(f) try: - compare = current_app.config["COMPARE"] - summary = process_data(file_name, compare, data) + summary = process_data(file_name, current_app.config["COMPARE"], data) except Exception as e: - return render_template("error.html", message=str(e), compare=compare) + return render_template("error.html", message=str(e)) return render_template( "report.html", data=data, file=file_name, summary=summary, - framework=current_app.config["FRAMEWORK"], - back=back, ) diff --git a/app/results/templates/_table_report.html b/app/results/templates/_table_report.html new file mode 100644 index 0000000..3d46ec3 --- /dev/null +++ b/app/results/templates/_table_report.html @@ -0,0 +1,110 @@ +
+
+
+
+ + + + + + + + {% if data.duration > 7200 %} + {% set unit = "h" %} + {% set divider = 3600 %} + {% 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 }}
+
+ +
+ + + + + + + + + + + + + + + {% for item in data.results %} + + + + + + + + + + + {% endfor %} + +
DatasetSamplesFeaturesClassesNodes{{ data.score_name|capitalize }}Timehyperparameters
{{ 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 }}
+ {% if summary|length > 0 %} +
+ + + + + + + + + + {% for key, value in summary.items() %} + + + + + + + {% endfor %} +
SymbolMeaningCount
{{ key }}{{ value[0] }} + {{ '{:,}'.format(value[1]) }} +
+
+ {% endif %} + + + Total score: {{ "%.6f" % (data.results | sum(attribute="score") ) }} + + + + Number of files: {{ data.results | length }} + +
+
+
diff --git a/app/results/templates/_table_select.html b/app/results/templates/_table_select.html index fb4ea9e..9e8d5c6 100644 --- a/app/results/templates/_table_select.html +++ b/app/results/templates/_table_select.html @@ -41,11 +41,11 @@ {% set file_best = "best_results_" ~ parts[1] ~ "_" ~ parts[2] ~ ".json" %}