Fix some mistakes

Add complexity to crossval
Change header of tex file
Add complexity fields to report_score
Add commented final date in database
This commit is contained in:
2021-04-08 08:32:22 +02:00
parent a23bae6b52
commit e592a33962
5 changed files with 43 additions and 70 deletions

View File

@@ -48,6 +48,7 @@ class MySQL:
def find_best(self, dataset, classifier="any", experiment="any"):
cursor = self._database.cursor(buffered=True)
date_from = "2021-01-20"
# date_to = "2021-04-07"
command = (
f"select * from results r inner join reference e on "
f"r.dataset=e.dataset where r.dataset='{dataset}'"
@@ -61,6 +62,7 @@ class MySQL:
command += f" and r.classifier in {classifier_set}"
elif classifier != "any":
command += f" and r.classifier='{classifier}'"
# 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 += (
@@ -411,6 +413,7 @@ class Hyperparameters(BD):
normalize,
standardize,
grid_type,
complexity,
):
rosetta = [
("mean_fit_time", "fit_time"),
@@ -460,6 +463,7 @@ class Hyperparameters(BD):
accuracy,
time_spent,
parameters,
complexity,
)
def report(self, dataset, exclude_params):

View File

@@ -182,6 +182,13 @@ class Experiment:
),
sort_keys=True,
)
if type(model).__name__ == "Stree":
best_model = grid_search.best_estimator_
nodes, leaves = best_model.nodes_leaves()
depth = best_model.depth_
else:
nodes = leaves = depth = 0
complexity = dict(nodes=nodes, leaves=leaves, depth=depth)
hyperparams.store(
dataset,
time_spent,
@@ -190,6 +197,7 @@ class Experiment:
normalize,
standardize,
grid_type,
complexity,
)
if self._num_warnings > 0:
print(f"{self._num_warnings} warnings have happend")