Description:
Currently, compute_poly_metric (and potentially other metric functions in metrics.py) contains conditional logic to handle the presence or absence of ground_truth_model. Even if ground_truth_model is "present" in the dataset, the ground truth model class is instantiated anyways, and repeatedly in each evaluate_<name_of_metric> call. This mixes configuration handling with metric computation, causes redundancy, and makes the code harder to maintain and test.
Proposed Options:
Move the conditional check out of compute_poly_metric (and other metrics) into one of the following:
MetricsParamsHandler.evaluate_metrics_polychromatic_lowres
- A pre-validation step during
MetricsParamsHandler.__init__, or a dedicated helper method like prepare_ground_truth_model
Preferred Approach:
Option 2 – handle the ground truth model setup in the initialization/pre-validation phase. This ensures that all metrics functions can safely assume a valid ground_truth_model and simplifies downstream logic.
Notes:
Description:
Currently,
compute_poly_metric(and potentially other metric functions inmetrics.py) contains conditional logic to handle the presence or absence ofground_truth_model. Even ifground_truth_modelis "present" in the dataset, the ground truth model class is instantiated anyways, and repeatedly in eachevaluate_<name_of_metric>call. This mixes configuration handling with metric computation, causes redundancy, and makes the code harder to maintain and test.Proposed Options:
Move the conditional check out of
compute_poly_metric(and other metrics) into one of the following:MetricsParamsHandler.evaluate_metrics_polychromatic_lowresMetricsParamsHandler.__init__, or a dedicated helper method likeprepare_ground_truth_modelPreferred Approach:
Option 2 – handle the ground truth model setup in the initialization/pre-validation phase. This ensures that all metrics functions can safely assume a valid
ground_truth_modeland simplifies downstream logic.Notes:
test_missing_ground_truth_model_raisesin Explore metrics_interface behavior under different evaluation flag configurations #186) can confirm that missingground_truth_modelraises an appropriate error.