Skip to content

Commit

Permalink
polishings
Browse files Browse the repository at this point in the history
  • Loading branch information
dvadym committed Jun 27, 2023
1 parent 0983c94 commit ba904c6
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 138 deletions.
8 changes: 5 additions & 3 deletions analysis/parameter_tuning.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,22 +304,24 @@ def _convert_utility_analysis_to_tune_result(
assert tune_options.function_to_minimize == MinimizingFunction.ABSOLUTE_ERROR

# Sort utility reports by configuration index.
utility_reports.sort(key=lambda e: e.configuration_index)
sorted_utility_reports = sorted(utility_reports,
key=lambda e: e.configuration_index)

index_best = -1 # not found
# Find best index if there are metrics to compute. Absence of metrics to
# compute means that this is SelectPartition analysis.
if tune_options.aggregate_params.metrics:
rmse = [
ur.metric_errors[0].absolute_error.rmse for ur in utility_reports
ur.metric_errors[0].absolute_error.rmse
for ur in sorted_utility_reports
]
index_best = np.argmin(rmse)

return TuneResult(tune_options,
contribution_histograms,
run_configurations,
index_best,
utility_reports=utility_reports)
utility_reports=sorted_utility_reports)


def _check_tune_args(options: TuneOptions):
Expand Down
Loading

0 comments on commit ba904c6

Please sign in to comment.