Fix normalize error

This commit is contained in:
2021-04-11 02:21:25 +02:00
parent 40d9b02ef2
commit dd83175508
554 changed files with 3891 additions and 7360 deletions

View File

@@ -20,8 +20,8 @@ models_ensemble = ["odte", "adaBoost", "bagging", "TBRaF", "TBRoF", "TBRRoF"]
description = ["samp", "var", "cls"]
complexity = ["nodes", "leaves", "depth"]
title = "Best model results"
lengths_acc = [30, 4, 3, 3, 3, 3, 3, 12, 12, 12, 12, 12, 12, 12]
lengths_time = [30, 4, 3, 3, 3, 3, 3, 17, 17, 17, 17, 17, 17, 17]
lengths_acc = [30, 4, 3, 3, 6, 6, 5, 12, 12, 12, 12, 12, 12, 12]
lengths_time = [30, 4, 3, 3, 6, 6, 5, 17, 17, 17, 17, 17, 17, 17]
def parse_arguments() -> Tuple[str, str, str, bool, bool]:
@@ -59,9 +59,10 @@ def parse_arguments() -> Tuple[str, str, str, bool, bool]:
ap.add_argument(
"-o",
"--compare",
type=bool,
type=int,
required=False,
default=False,
default=1,
help="1=stree optimized, 2=stree_default, 3=both",
)
ap.add_argument(
"-i",
@@ -176,8 +177,10 @@ def report_header(title, experiment, model_type):
def report_line(line):
output = f"{line['dataset']:{lengths[0] + 5}s} "
for key, item in enumerate(description + complexity):
for key, item in enumerate(description):
output += f"{line[item]:{lengths[key + 1]}d} "
for key, item in enumerate(complexity):
output += f"{line[item]:{lengths[key + len(description) + 1]}.2f} "
data = models.copy()
for key, model in enumerate(data):
output += f"{line[model]:{lengths[key + 7]}s} "
@@ -215,17 +218,22 @@ fields = (
"Samp",
"Var",
"Cls",
"Nod",
"Lea",
"Dep",
"Nodes",
"Leave",
"Depth",
)
lengths = lengths_time if time_info else lengths_acc
reference_model = "stree"
if tex_output:
# We need the stree_std column for the tex output
compare = True
if not compare:
# We need the stree & stree_std column for the tex output
compare = 3
if compare != 3:
# remove stree_default from fields list and lengths
models_tree.pop(1)
if compare == 1:
models_tree.pop(1)
else:
models_tree.pop(0)
reference_model = "stree_default"
lengths.pop(7)
models = models_tree if model_type == "tree" else models_ensemble
for item in models:
@@ -256,16 +264,16 @@ for number, dataset in enumerate(dt):
max_accuracy = (
0.0 if record is None else record[9] if time_info else record[5]
)
line["nodes"] = 0
line["leaves"] = 0
line["depth"] = 0
line["nodes"] = 0.0
line["leaves"] = 0.0
line["depth"] = 0.0
line_tex = line.copy()
for column, model in enumerate(models):
record = dbh.find_best(dataset[0], model, experiment)
if record is None:
line[model] = color + "-" * 12
else:
if model == "stree":
if model == reference_model:
line["nodes"] = record[12]
line["leaves"] = record[13]
line["depth"] = record[14]