Skip to content
Snippets Groups Projects
Commit 35a0e455 authored by Pierre LOTTE's avatar Pierre LOTTE
Browse files

Ajout boucle résultats concis + modification arg split

parent cd6b84c3
No related branches found
No related tags found
No related merge requests found
...@@ -135,7 +135,7 @@ if __name__ == "__main__": ...@@ -135,7 +135,7 @@ if __name__ == "__main__":
# Split data # Split data
# ================================================================================================================= # =================================================================================================================
if args.split: if args.split and args.task in ["train", "all"]:
splitter = BaseSplitter(f"{INPUT_DIR}/{config_name}") splitter = BaseSplitter(f"{INPUT_DIR}/{config_name}")
splitter.split_data() splitter.split_data()
......
...@@ -42,9 +42,9 @@ class ROCResults(BaseResults): ...@@ -42,9 +42,9 @@ class ROCResults(BaseResults):
fpr, tpr, _ = roc_curve(labels, y_pred) fpr, tpr, _ = roc_curve(labels, y_pred)
if algo in self.result: if algo in self.result:
self.result[algo][config_name] = {"classic": round(score, 2)} self.result[algo][config_name] = {"classic": round(score, 4)}
else: else:
self.result[algo] = {config_name: {"classic": round(score, 2)}} self.result[algo] = {config_name: {"classic": round(score, 4)}}
plt.rcParams["figure.figsize"] = (10, 10) plt.rcParams["figure.figsize"] = (10, 10)
plt.plot(fpr, tpr) plt.plot(fpr, tpr)
...@@ -71,7 +71,7 @@ class ROCResults(BaseResults): ...@@ -71,7 +71,7 @@ class ROCResults(BaseResults):
result = np.maximum(result, y_pred) result = np.maximum(result, y_pred)
score = roc_auc_score(labels, result) score = roc_auc_score(labels, result)
self.result[algo][f"{config_name}"]["auto_split"] = round(score, 2) self.result[algo][f"{config_name}"]["auto_split"] = round(score, 4)
# Compute results for splitted dataset # Compute results for splitted dataset
files = __exec(f"find -L {self.path}/{config_name}/results_{algo} -regex '^.*dataset[_0-9]+_{algo}.ts'") files = __exec(f"find -L {self.path}/{config_name}/results_{algo} -regex '^.*dataset[_0-9]+_{algo}.ts'")
...@@ -87,10 +87,24 @@ class ROCResults(BaseResults): ...@@ -87,10 +87,24 @@ class ROCResults(BaseResults):
result = np.maximum(result, y_pred) result = np.maximum(result, y_pred)
score = roc_auc_score(labels, result) score = roc_auc_score(labels, result)
self.result[algo][f"{config_name}"]["split"] = round(score, 2) self.result[algo][f"{config_name}"]["split"] = round(score, 4)
print(json.dumps(self.result)) print(json.dumps(self.result))
# for algo, algo_res in self.result.items():
# l_classic = []
# l_auto_split = []
# l_split = []
# for details in algo_res.values():
# l_classic.append(details["classic"])
# l_auto_split.append(details["auto_split"])
# l_split.append(details["split"])
# print(f"{algo}:")
# print(f"\tClassic: {np.mean(l_classic)} ({np.std(l_classic)})")
# print(f"\tAuto split: {np.mean(l_auto_split)} ({np.std(l_auto_split)})")
# print(f"\tSplit: {np.mean(l_split)} ({np.std(l_split)})")
def __vote_for_score(self, scores, length): def __vote_for_score(self, scores, length):
""" """
Compute the score for each point of the dataset instead of a per window basis. Compute the score for each point of the dataset instead of a per window basis.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment