code: def suggest(new_ids, domain, trials, seed):
      optimizer = ATPEOptimizer()
  
      # Convert the PyLL domain back into a descriptive form of hyperparameter space
      hyperparameterConfig = (
          Hyperparameter.createHyperparameterConfigForHyperoptDomain(
              domain
          )
      )
  
      results = optimizer.convertTrialsToResults(
          hyperparameterConfig, trials
      )
  
      # If there is a loss value that is negative, then we must increment the values so
      # they are all positive. This is because ATPE has been optimized only for positive
      # loss value
      if len(results) > 0:
          minVal = min(
              [
                  result["loss"]
                  for result in results
                  if result["loss"] is not None
              ]
          )
          if minVal < 0:
              for result in results:
                  if result["loss"] is not None:
                      result["loss"] = result["loss"] - minVal + 0.1
  
      hyperparameters = Hyperparameter(hyperparameterConfig)
  
      rval = []
      for new_id in new_ids:
          parameters = optimizer.recommendNextParameters(
              hyperparameterConfig, results, currentTrials=[]
          )
          flatParameters = hyperparameters.convertToFlatValues(
              parameters
          )
  
          rval_results = [domain.new_result()]
          rval_miscs = [
              dict(
                  tid=new_id,
                  cmd=domain.cmd,
                  workdir=domain.workdir,
                  idxs={key: [0] for key in flatParameters},
                  vals={
                      key: [flatParameters[key]]
                      for key in flatParameters
                  },
              )
          ]
  
          rval.extend(
              trials.new_trial_docs(
                  [new_id], [None], rval_results, rval_miscs
              )
          )
  
      return rval
  
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 2 for calling a global function with example usage: suggest(new_ids, domain, trials, seed) and returns: rval