Update analysis and report mysql

This commit is contained in:
2021-03-05 10:41:18 +01:00
parent 116db3f528
commit a075e5e95a
3 changed files with 46 additions and 31 deletions

View File

@@ -46,18 +46,21 @@ class MySQL:
def find_best(self, dataset, classifier="any", experiment="any"):
cursor = self._database.cursor(buffered=True)
if classifier == "any":
command = (
f"select * from results r inner join reference e on "
f"r.dataset=e.dataset where r.dataset='{dataset}' and "
f"date>='2021-01-20'"
)
else:
command = (
f"select * from results r inner join reference e on "
f"r.dataset=e.dataset where r.dataset='{dataset}' and "
f"classifier='{classifier}' and date>='2021-01-20'"
)
date_from = "2021-01-20"
command = (
f"select * from results r inner join reference e on "
f"r.dataset=e.dataset where r.dataset='{dataset}'"
)
if isinstance(classifier, list):
classifier_set = "("
for i, item in enumerate(classifier):
comma = "" if i == 0 else ","
classifier_set += f"{comma}'{item}'"
classifier_set += ")"
command += f" and r.classifier in {classifier_set}"
elif classifier != "any":
command += f" and r.classifier='{classifier}'"
command += f" and date>='{date_from}'"
command += "" if experiment == "any" else f" and type='{experiment}'"
command += (
" order by r.dataset, accuracy desc, classifier desc, "
@@ -182,7 +185,8 @@ class BD(ABC):
database = dbh.get_connection()
command_insert = (
"replace into results (date, time, type, accuracy, "
"dataset, classifier, norm, stand, parameters, accuracy_std, time_spent, time_spent_std) values (%s, %s, "
"dataset, classifier, norm, stand, parameters, accuracy_std, "
"time_spent, time_spent_std) values (%s, %s, "
"%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
)
now = datetime.now()