class_docstr: a framework for benchmarking the optimizer
  
  Parameters
  ----------
  function_name : string
  fun : callable
  der : callable
      function that returns the derivative (jacobian, gradient) of fun
  hess : callable
      function that returns the hessian of fun
  minimizer_kwargs : kwargs
      additional keywords passed to the minimizer.  e.g. tol, maxiter
class_docstr_tok: ["a","framework","for","benchmarking","the","optimizer","Parameters","--","--","--","--","--","function_name",":","string","fun",":","callable","der",":","callable","function","that","returns","the","derivative","(","jacobian",",","gradient",")","of","fun","hess",":","callable","function","that","returns","the","hessian","of","fun","minimizer_kwargs",":","kwargs","additional","keywords","passed","to","the","minimizer",".","e.g",".","tol",",","maxiter"]
docstr: group the results by minimizer and average over the runs
docstr_tok: ["group","the","results","by","minimizer","and","average","over","the","runs"]
code: def average_results(self):
      """group the results by minimizer and average over the runs"""
      grouped_results = defaultdict(list)
      for res in self.results:
          grouped_results[res.name].append(res)
  
      averaged_results = dict()
      for name, result_list in grouped_results.items():
          newres = scipy.optimize.OptimizeResult()
          newres.name = name
          newres.mean_nfev = np.mean([r.nfev for r in result_list])
          newres.mean_njev = np.mean([r.njev for r in result_list])
          newres.mean_nhev = np.mean([r.nhev for r in result_list])
          newres.mean_time = np.mean([r.time for r in result_list])
          funs = [r.fun for r in result_list]
          newres.max_obj = np.max(funs)
          newres.min_obj = np.min(funs)
          newres.mean_obj = np.mean(funs)
  
          newres.ntrials = len(result_list)
          newres.nfail = len([r for r in result_list if not r.success])
          newres.nsuccess = len([r for r in result_list if r.success])
          try:
              newres.ndim = len(result_list[0].x)
          except TypeError:
              newres.ndim = 1
          averaged_results[name] = newres
      return averaged_results
  
imports: import os
  import time
  import inspect
  import json
  import traceback
  from collections import defaultdict
  import numpy
  from .None import test_functions
  from .None import go_benchmark_functions
  from .common import Benchmark, is_xslow, safe_import
  from .lsq_problems import extract_lsq_problems
label_desc: Use image node_id 7 for calling the _BenchOptimizers obj's underlying member method code with example usage: obj.average_results() and returns: averaged_results