class_docstr: This class wraps an optimizer to allow a human to provide additional guidance to it.
class_docstr_tok: ["This","class","wraps","an","optimizer","to","allow","a","human","to","provide","additional","guidance","to","it","."]
code: def recommendNextParameters(
      self,
      hyperparameterSpace,
      results,
      currentTrials,
      lockedValues=None,
  ):
      if lockedValues is None:
          lockedValues = {}
  
      for lockedParam in self.guidanceOptions["lockedParameters"]:
          lockedValues[lockedParam["variable"]] = lockedParam["value"]
  
      for scrambledParam in self.guidanceOptions["scrambleParameters"]:
          parameters = Hyperparameter(
              hyperparameterSpace
          ).getFlatParameters()
  
          parameter = [
              param
              for param in parameters
              if param.name == scrambledParam["variable"]
          ][0]
  
          minVal = parameter.config["min"]
          maxVal = parameter.config["max"]
  
          if parameter.config.get("scaling", "linear") == "logarithmic":
              minVal = math.log(minVal)
              maxVal = math.log(maxVal)
  
          value = random.uniform(minVal, maxVal)
  
          if parameter.config.get("scaling", "linear") == "logarithmic":
              value = math.exp(value)
  
          if "rounding" in parameter.config:
              value = (
                  round(value / parameter.config["rounding"])
                  * parameter.config["rounding"]
              )
  
          lockedValues[parameter.name] = value
  
      refitParameters = sorted(
          self.guidanceOptions["refitParameters"],
          key=lambda p: p["refitStartTrial"],
      )
  
      refitNames = [
          refitParam["variable"] for refitParam in refitParameters
      ]
  
      primarySpace = self.filterHyperparameterSpace(
          hyperparameterSpace, refitNames
      )
  
      # Filter results to remove the non primary variables
      primaryResults = self.filterResults(results, refitNames)
      recommendedParams = self.baseOptimizer.recommendNextParameters(
          primarySpace, primaryResults, currentTrials, lockedValues
      )
  
      # print(recommendedParams)
  
      for index, refitParam in enumerate(refitParameters):
          startTrial = refitParam["refitStartTrial"]
  
          # For each refit parameter, we predict after locking in the all previous parameters
          remainingRefits = refitParameters[index + 1 :]
          # pprint("filteredSpace", filteredSpace)
  
          newLockedValues = self.createFlatParameterValues(
              recommendedParams,
              self.filterHyperparameterSpace(
                  hyperparameterSpace, refitNames[index:]
              ),
          )
  
          # pprint("newLockedValues", newLockedValues)
          filteredSpace = self.filterHyperparameterSpace(
              hyperparameterSpace, remainingRefits
          )
          filteredResults = self.filterResults(
              results[startTrial + 1 :], remainingRefits
          )
  
          refitReccomendation = (
              self.baseOptimizer.recommendNextParameters(
                  filteredSpace,
                  filteredResults,
                  currentTrials,
                  newLockedValues,
              )
          )
  
          recommendedParams = refitReccomendation
  
      return recommendedParams
  
file_path: hypermax/hypermax/algorithms/human_guided_optimizer_wrapper.py
imports: from .optimization_algorithm_base import OptimizationAlgorithmBase
  import hyperopt
  import functools
  import random
  import numpy
  import math
  import numpy.random
  from pprint import pprint
  from hypermax.hyperparameter import Hyperparameter
label_desc: Use image node_id 6 for calling the HumanGuidedOptimizerWrapper obj's underlying member method code with example usage: obj.recommendNextParameters(hyperparameterSpace, results, currentTrials, lockedValues) and returns: recommendedParams