class_docstr: Takes another algorithm and repeats every hyperparameter configuration a
  given number of times. The wrapped algorithm will be passed the mean
  objective values of the repeated experiments.
  
  Args:
      algorithm (sherpa.algorithms.Algorithm): the algorithm to produce
          hyperparameter configurations.
      num_times (int): the number of times to repeat each configuration.
      wait_for_completion (bool): only relevant when running in parallel with
          max_concurrent > 1. Means that the algorithm won't issue the next
          suggestion until all repetitions are completed. This can be useful
          when the repeats have impact on sequential decision making in the
          wrapped algorithm.
      agg (bool): whether to aggregate repetitions before passing them to the
          parameter generating algorithm.
class_docstr_tok: ["Takes","another","algorithm","and","repeats","every","hyperparameter","configuration","a","given","number","of","times",".","The","wrapped","algorithm","will","be","passed","the","mean","objective","values","of","the","repeated","experiments",".","Args",":","algorithm","(","sherpa.algorithms.Algorithm",")",":","the","algorithm","to","produce","hyperparameter","configurations",".","num_times","(","int",")",":","the","number","of","times","to","repeat","each","configuration",".","wait_for_completion","(","bool",")",":","only","relevant","when","running","in","parallel","with","max_concurrent",">","1",".","Means","that","the","algorithm","wo","n't","issue","the","next","suggestion","until","all","repetitions","are","completed",".","This","can","be","useful","when","the","repeats","have","impact","on","sequential","decision","making","in","the","wrapped","algorithm",".","agg","(","bool",")",":","whether","to","aggregate","repetitions","before","passing","them","to","the","parameter","generating","algorithm","."]
code: def get_best_result(self, parameters, results, lower_is_better):
      agg_results = self.aggregate_results(
          results=results,
          parameters=parameters,
          min_count=self.num_times,
      )
  
      if agg_results.empty:
          return {}
  
      # Get best result so far
      best_idx = (
          agg_results.loc[:, "Objective"].idxmin()
          if lower_is_better
          else agg_results.loc[:, "Objective"].idxmax()
      )
  
      if not numpy.isfinite(best_idx):
          # Can happen if there are no valid results,
          # best_idx=nan when results are nan.
          alglogger.warning(
              "Empty results file! Returning empty dictionary."
          )
          return {}
  
      best_result = agg_results.loc[best_idx, :].to_dict("records")[0]
      best_result.pop("Status")
      return best_result
  
imports: import os
  import random
  import numpy
  import logging
  import sherpa
  import pandas
  import sklearn.gaussian_process
  from sherpa.core import Choice, Continuous, Discrete, Ordinal, AlgorithmState
  from sherpa.core import rng
  import sklearn.model_selection
  import collections
label_desc: Use image node_id 3 for calling the Repeat obj's underlying member method code with example usage: obj.get_best_result(parameters, results, lower_is_better) and returns: best_result, dict, dict