Skip to content

Commit

Permalink
Raise an exception if the number of repetitions of each algorithm doe…
Browse files Browse the repository at this point in the history
…s not match.

Partial fix for #7
  • Loading branch information
olafmersmann committed Jul 24, 2024
1 parent 9add190 commit d3bd82e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/cocoviz/rtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,21 @@ def runtime_profiles(
indicator_results.append(r.at_indicator(indicator, targets[r.problem]))

res = {}
for algo, algo_results in indicator_results.by_algorithm():
n_results = None
for algo, algo_results in indicator_results.by_algorithm():
# Make sure each algorithm has the same number of repetitions/runs If
# not, raise an exception for now. In the future we could try to down-
# or upsample the offending algorithm.
if n_results is None:
n_results = len(algo_results)
elif n_results != len(algo_results):
raise BadRuntimeProfileException(f"Expected {n_results} results for algorithm {algo}, found {len(results)}.")

runtimes = []

for algo_result in algo_results:
runtimes.append(algo_result._data[["__fevals_dim", "__target_hit"]])

runtimes = pl.concat(runtimes)
ecdf = stats.ecdf(
stats.CensoredData(
Expand Down

0 comments on commit d3bd82e

Please sign in to comment.