Skip to content
Snippets Groups Projects
Commit 18b5d9e6 authored by Daniel CARRON's avatar Daniel CARRON :b: Committed by André Anjos
Browse files

[experiment] Check validation split exists for evaluation threshold

If no split named "validation" exists, the experiment will use the
"train" split to compute the threshold.
parent 14816eae
No related branches found
No related tags found
1 merge request!46Create common library
......@@ -2,6 +2,7 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
import json
from datetime import datetime
import click
......@@ -133,11 +134,23 @@ def experiment(
from .evaluate import evaluate
predictions_file = predictions_output / "predictions.json"
with (predictions_output / "predictions.json").open() as pf:
splits = json.load(pf).keys()
if "validation" in splits:
evaluation_threshold = "validation"
elif "train" in splits:
evaluation_threshold = "train"
else:
evaluation_threshold = None
ctx.invoke(
evaluate,
predictions=predictions_output / "predictions.json",
predictions=predictions_file,
output_folder=output_folder,
threshold="validation",
threshold=evaluation_threshold,
)
evaluation_stop_timestamp = datetime.now()
......
......@@ -2,6 +2,7 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
import json
from datetime import datetime
import click
......@@ -138,11 +139,23 @@ def experiment(
evaluation_output = output_folder / "evaluation"
predictions_file = predictions_output / "predictions.json"
with (predictions_output / "predictions.json").open() as pf:
splits = json.load(pf).keys()
if "validation" in splits:
evaluation_threshold = "validation"
elif "train" in splits:
evaluation_threshold = "train"
else:
evaluation_threshold = None
ctx.invoke(
evaluate,
predictions=predictions_output / "predictions.json",
predictions=predictions_file,
output_folder=evaluation_output,
threshold=0.5,
threshold=evaluation_threshold,
)
evaluation_stop_timestamp = datetime.now()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment