Add time analysis

This commit is contained in:
2021-04-09 01:37:28 +02:00
parent 510c89f187
commit 40d9b02ef2
2 changed files with 47 additions and 17 deletions

View File

@@ -45,7 +45,9 @@ class MySQL:
self._database = mysql.connector.connect(**self._config_db)
return self._database
def find_best(self, dataset, classifier="any", experiment="any"):
def find_best(
self, dataset, classifier="any", experiment="any", time_info=False
):
cursor = self._database.cursor(buffered=True)
date_from = "2021-01-20"
# date_to = "2021-04-07"
@@ -65,10 +67,16 @@ class MySQL:
# command += f" and date>='{date_from}' and date<='{date_to}'"
command += f" and date>='{date_from}'"
command += "" if experiment == "any" else f" and type='{experiment}'"
command += (
" order by r.dataset, accuracy desc, classifier desc, "
"type, date, time"
)
if time_info:
command += (
" order by r.dataset, time_spent asc, classifier desc, "
"type, date, time"
)
else:
command += (
" order by r.dataset, accuracy desc, classifier desc, "
"type, date, time"
)
cursor.execute(command)
return cursor.fetchone()