Skip to content
Snippets Groups Projects
Commit 4adfbc8f authored by Baptiste Bauvin's avatar Baptiste Bauvin
Browse files

Simplified the config file by allowing to no config for a classifier

parent d7adcf83
Branches
Tags
No related merge requests found
Pipeline #3871 passed
...@@ -20,12 +20,12 @@ Classification: ...@@ -20,12 +20,12 @@ Classification:
multiclass_method: "oneVersusOne" multiclass_method: "oneVersusOne"
split: 0.4 split: 0.4
nb_folds: 2 nb_folds: 2
nb_class: 3 nb_class: 2
classes: classes:
type: ["monoview"] type: ["multiview"]
algos_monoview: ["decision_tree",] algos_monoview: ["decision_tree","bayesian_inference_fusion"]
algos_multiview: ["svm_jumbo_fusion"] algos_multiview: ["svm_jumbo_fusion"]
stats_iter: 2 stats_iter: 1
metrics: ["accuracy_score", "f1_score"] metrics: ["accuracy_score", "f1_score"]
metric_princ: "f1_score" metric_princ: "f1_score"
hps_type: "randomized_search-equiv" hps_type: "randomized_search-equiv"
...@@ -132,7 +132,7 @@ weighted_linear_early_fusion: ...@@ -132,7 +132,7 @@ weighted_linear_early_fusion:
splitter: ["best"] splitter: ["best"]
entropy_fusion: entropy_fusion:
classifier_names: [["decision_tree"]] classifiers_names: [["decision_tree"]]
classifier_configs: classifier_configs:
decision_tree: decision_tree:
max_depth: [1] max_depth: [1]
...@@ -140,7 +140,7 @@ entropy_fusion: ...@@ -140,7 +140,7 @@ entropy_fusion:
splitter: ["best"] splitter: ["best"]
disagree_fusion: disagree_fusion:
classifier_names: [["decision_tree"]] classifiers_names: [["decision_tree"]]
classifier_configs: classifier_configs:
decision_tree: decision_tree:
max_depth: [1] max_depth: [1]
...@@ -149,7 +149,7 @@ disagree_fusion: ...@@ -149,7 +149,7 @@ disagree_fusion:
double_fault_fusion: double_fault_fusion:
classifier_names: [["decision_tree"]] classifiers_names: [["decision_tree"]]
classifier_configs: classifier_configs:
decision_tree: decision_tree:
max_depth: [1] max_depth: [1]
...@@ -157,7 +157,7 @@ double_fault_fusion: ...@@ -157,7 +157,7 @@ double_fault_fusion:
splitter: ["best"] splitter: ["best"]
difficulty_fusion: difficulty_fusion:
classifier_names: [["decision_tree"]] classifiers_names: [["decision_tree"]]
classifier_configs: classifier_configs:
decision_tree: decision_tree:
max_depth: [1] max_depth: [1]
...@@ -165,7 +165,7 @@ difficulty_fusion: ...@@ -165,7 +165,7 @@ difficulty_fusion:
splitter: ["best"] splitter: ["best"]
scm_late_fusion: scm_late_fusion:
classifier_names: [["decision_tree"]] classifiers_names: [["decision_tree"]]
p: 0.1 p: 0.1
max_rules: 10 max_rules: 10
model_type: 'conjunction' model_type: 'conjunction'
...@@ -176,7 +176,7 @@ scm_late_fusion: ...@@ -176,7 +176,7 @@ scm_late_fusion:
splitter: ["best"] splitter: ["best"]
majority_voting_fusion: majority_voting_fusion:
classifier_names: [["decision_tree", "decision_tree", "decision_tree", ]] classifiers_names: [["decision_tree", "decision_tree", "decision_tree", ]]
classifier_configs: classifier_configs:
decision_tree: decision_tree:
max_depth: [1] max_depth: [1]
...@@ -184,7 +184,7 @@ majority_voting_fusion: ...@@ -184,7 +184,7 @@ majority_voting_fusion:
splitter: ["best"] splitter: ["best"]
bayesian_inference_fusion: bayesian_inference_fusion:
classifier_names: [["decision_tree", "decision_tree", "decision_tree", ]] classifiers_names: [["decision_tree", "decision_tree", "decision_tree", ]]
classifier_configs: classifier_configs:
decision_tree: decision_tree:
max_depth: [1] max_depth: [1]
...@@ -192,7 +192,7 @@ bayesian_inference_fusion: ...@@ -192,7 +192,7 @@ bayesian_inference_fusion:
splitter: ["best"] splitter: ["best"]
weighted_linear_late_fusion: weighted_linear_late_fusion:
classifier_names: [["decision_tree", "decision_tree", "decision_tree", ]] classifiers_names: [["decision_tree", "decision_tree", "decision_tree", ]]
classifier_configs: classifier_configs:
decision_tree: decision_tree:
max_depth: [1] max_depth: [1]
...@@ -222,5 +222,4 @@ mvml: ...@@ -222,5 +222,4 @@ mvml:
kernel_configs: kernel_configs:
gamma: [0.1] gamma: [0.1]
svm_jumbo_fusion:
degree: [1]
...@@ -107,6 +107,7 @@ def init_multiview_exps(classifier_names, views_dictionary, nb_class, kwargs_ini ...@@ -107,6 +107,7 @@ def init_multiview_exps(classifier_names, views_dictionary, nb_class, kwargs_ini
views_dictionary=views_dictionary, views_dictionary=views_dictionary,
framework="multiview") framework="multiview")
else: else:
print(classifier_name)
arguments = get_path_dict(kwargs_init[classifier_name]) arguments = get_path_dict(kwargs_init[classifier_name])
multiview_arguments += [gen_single_multiview_arg_dictionary(classifier_name, multiview_arguments += [gen_single_multiview_arg_dictionary(classifier_name,
arguments, arguments,
...@@ -161,8 +162,12 @@ def init_monoview_exps(classifier_names, ...@@ -161,8 +162,12 @@ def init_monoview_exps(classifier_names,
def gen_single_monoview_arg_dictionary(classifier_name, arguments, nb_class, def gen_single_monoview_arg_dictionary(classifier_name, arguments, nb_class,
view_index, view_name): view_index, view_name):
return {classifier_name: dict((key, value[0]) for key, value in arguments[ if classifier_name in arguments:
classifier_name].items()), classifier_config = dict((key, value[0]) for key, value in arguments[
classifier_name].items())
else:
classifier_config = {}
return {classifier_name: classifier_config,
"view_name": view_name, "view_name": view_name,
"view_index": view_index, "view_index": view_index,
"classifier_name": classifier_name, "classifier_name": classifier_name,
...@@ -375,7 +380,10 @@ def init_kwargs(args, classifiers_names, framework="monoview"): ...@@ -375,7 +380,10 @@ def init_kwargs(args, classifiers_names, framework="monoview"):
raise AttributeError( raise AttributeError(
classifiers_name + " is not implemented in monoview_classifiers, " classifiers_name + " is not implemented in monoview_classifiers, "
"please specify the name of the file in monoview_classifiers") "please specify the name of the file in monoview_classifiers")
if classifiers_name in args:
kwargs[classifiers_name] = args[classifiers_name] kwargs[classifiers_name] = args[classifiers_name]
else:
kwargs[classifiers_name] = {}
logging.debug("Done:\t Initializing monoview classifiers arguments") logging.debug("Done:\t Initializing monoview classifiers arguments")
return kwargs return kwargs
......
...@@ -685,7 +685,7 @@ def publish_tracebacks(directory, database_name, labels_names, tracebacks, flag) ...@@ -685,7 +685,7 @@ def publish_tracebacks(directory, database_name, labels_names, tracebacks, flag)
with open(os.path.join(directory, time.strftime( with open(os.path.join(directory, time.strftime(
"%Y_%m_%d-%H_%M_%S") + "-" + database_name + "-" + "_vs_".join( "%Y_%m_%d-%H_%M_%S") + "-" + database_name + "-" + "_vs_".join(
labels_names) + "-iter"+str(flag[0])+"-"+str(flag[1][0])+"vs"+ labels_names) + "-iter"+str(flag[0])+"-"+str(flag[1][0])+"vs"+
str(flag[1][1])+"tacebacks.txt"), "w") as traceback_file: str(flag[1][1])+"-tacebacks.txt"), "w") as traceback_file:
failed_list = save_dict_to_text(tracebacks, traceback_file) failed_list = save_dict_to_text(tracebacks, traceback_file)
flagged_list = [_ + "-iter"+str(flag[0])+"-"+str(flag[1][0])+"vs"+ flagged_list = [_ + "-iter"+str(flag[0])+"-"+str(flag[1][0])+"vs"+
str(flag[1][1]) for _ in failed_list] str(flag[1][1]) for _ in failed_list]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment