Skip to content

Commit

Permalink
[cocopp] implement detEvals_by_instance for getting runtimes by instance
Browse files Browse the repository at this point in the history
  • Loading branch information
nikohansen committed Jun 30, 2024
1 parent 692a037 commit a0d9c72
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions code-postprocessing/cocopp/pproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1688,6 +1688,21 @@ def detEvals(self, targets, copy=True, bootstrap=False, append_instances=False):
for t in targets]
return [evalsrows[t] for t in targets] # order w.r.t. input targets

def detEvals_by_instance(self, targets, raw_values=True, **kwargs):
"""return result of `detEvals` for each instance individually
in an `OrderedDict` whos keys are all elements of `instancenumbers`.
``raw_data=True`` means no instance balancing/repetitions.
See `detEvals` for further keyword arguments.
"""
evals_list = self.detEvals(targets, **kwargs)
res = collections.OrderedDict()
for i, idx in self.instance_index_lists(raw_values).items():
res[i] = [evals[idx] for evals in evals_list]
return res

def _number_of_better_runs(self, target, ref_eval):
"""return the number of ``self.evals(target)`` that are smaller
Expand Down

0 comments on commit a0d9c72

Please sign in to comment.