Skip to content
Snippets Groups Projects
Commit 1633f84c authored by Ivan Pavlovich's avatar Ivan Pavlovich
Browse files

Modified graph script to ignore models with no result file

parent 0b931ad7
Branches
No related tags found
No related merge requests found
dataSources/PubMed/tmp/* dataSources/PubMed/tmp/*
testModel/results/graphs/*
.venv .venv
\ No newline at end of file
...@@ -26,17 +26,31 @@ models = [model for model in MODELS.keys()] ...@@ -26,17 +26,31 @@ models = [model for model in MODELS.keys()]
metrics = ["TPR", "TNR", "Precision", "F1"] metrics = ["TPR", "TNR", "Precision", "F1"]
models_results = {} models_results = {}
usable_models = []
for model in models: for model in models:
with open(f"{RESULTS_DIR}/{get_filename(model)}.json", "r", encoding="utf-8") as file: file_path = f"{RESULTS_DIR}/{get_filename(model)}.json"
if not os.path.exists(file_path):
print(f"Warning: File {file_path} not found. Skipping model {model}.")
continue
with open(file_path, "r", encoding="utf-8") as file:
data = json.load(file) data = json.load(file)
if "results" not in data:
print(f"Warning: 'results' key missing in {file_path}. Skipping model {model}.")
continue
for length_category in length_categories: for length_category in length_categories:
values = [data["results"][length_category][metric] for metric in metrics] values = [data["results"][length_category][metric] for metric in metrics]
data["results"][length_category] = values data["results"][length_category] = values
models_results[model] = data["results"] models_results[model] = data["results"]
usable_models.append(model)
models = usable_models
print("GENERATING BAR PLOTS") print("GENERATING BAR PLOTS")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment