code: def computeAllResultStatistics(self, hyperparameterSpace, results):
      losses = numpy.array(
          sorted(
              [
                  result["loss"]
                  for result in results
                  if result["loss"] is not None
              ]
          )
      )
  
      if len(set(losses)) > 1:
          percentile10Loss = numpy.percentile(losses, 10)
          percentile20Loss = numpy.percentile(losses, 20)
          percentile30Loss = numpy.percentile(losses, 30)
      else:
          percentile10Loss = losses[0]
          percentile20Loss = losses[0]
          percentile30Loss = losses[0]
  
      allResults = list(results)
      percentile10Results = [
          result
          for result in results
          if result["loss"] is not None
          and result["loss"] <= percentile10Loss
      ]
      percentile20Results = [
          result
          for result in results
          if result["loss"] is not None
          and result["loss"] <= percentile20Loss
      ]
      percentile30Results = [
          result
          for result in results
          if result["loss"] is not None
          and result["loss"] <= percentile30Loss
      ]
  
      recent10Count = min(len(results), 10)
      recent10Results = results[-recent10Count:]
  
      recent25Count = min(len(results), 25)
      recent25Results = results[-recent25Count:]
  
      recent15PercentCount = max(math.ceil(len(results) * 0.15), 5)
      recent15PercentResults = results[-recent15PercentCount:]
  
      statistics = {}
      allResultStatistics = self.computePartialResultStatistics(
          hyperparameterSpace, allResults
      )
      for stat, value in allResultStatistics.items():
          statistics["all_" + stat] = value
  
      percentile10Statistics = self.computePartialResultStatistics(
          hyperparameterSpace, percentile10Results
      )
      for stat, value in percentile10Statistics.items():
          statistics["top_10%_" + stat] = value
  
      percentile20Statistics = self.computePartialResultStatistics(
          hyperparameterSpace, percentile20Results
      )
      for stat, value in percentile20Statistics.items():
          statistics["top_20%_" + stat] = value
  
      percentile30Statistics = self.computePartialResultStatistics(
          hyperparameterSpace, percentile30Results
      )
      for stat, value in percentile30Statistics.items():
          statistics["top_30%_" + stat] = value
  
      recent10Statistics = self.computePartialResultStatistics(
          hyperparameterSpace, recent10Results
      )
      for stat, value in recent10Statistics.items():
          statistics["recent_10_" + stat] = value
  
      recent25Statistics = self.computePartialResultStatistics(
          hyperparameterSpace, recent25Results
      )
      for stat, value in recent25Statistics.items():
          statistics["recent_25_" + stat] = value
  
      recent15PercentResult = self.computePartialResultStatistics(
          hyperparameterSpace, recent15PercentResults
      )
      for stat, value in recent15PercentResult.items():
          statistics["recent_15%_" + stat] = value
  
      # Although we have added lots of protection in the computePartialResultStatistics code, one last hedge against any NaN or infinity values coming up
      # in our statistics
      for key in statistics.keys():
          if math.isnan(statistics[key]) or math.isinf(statistics[key]):
              statistics[key] = 0
  
      return statistics
  
imports: from hyperopt import hp
  from contextlib import contextmanager
  import re
  import functools
  import random
  import numpy
  import numpy.random
  import pkg_resources
  import tempfile
  import scipy.stats
  import os
  import math
  import hyperopt
  import datetime
  import json
  import copy
label_desc: Use image node_id 5 for calling the ATPEOptimizer obj's underlying member method code with example usage: obj.computeAllResultStatistics(hyperparameterSpace, results) and returns: statistics