class_docstr: Manages hyperparameter optimisation using random search for a single GPU.
  
  Attributes:
    param_ranges: Discrete hyperparameter range for random search.
    results: Dataframe of validation results.
    fixed_params: Fixed model parameters per experiment.
    saved_params: Dataframe of parameters trained.
    best_score: Minimum validation loss observed thus far.
    optimal_name: Key to best configuration.
    hyperparam_folder: Where to save optimisation outputs.
class_docstr_tok: ["Manages","hyperparameter","optimisation","using","random","search","for","a","single","GPU",".","Attributes",":","param_ranges",":","Discrete","hyperparameter","range","for","random","search",".","results",":","Dataframe","of","validation","results",".","fixed_params",":","Fixed","model","parameters","per","experiment",".","saved_params",":","Dataframe","of","parameters","trained",".","best_score",":","Minimum","validation","loss","observed","thus","far",".","optimal_name",":","Key","to","best","configuration",".","hyperparam_folder",":","Where","to","save","optimisation","outputs","."]
docstr: Returns the next set of parameters to optimise.
  
  Args:
    ranges_to_skip: Explicitly defines a set of keys to skip.
docstr_tok: ["Returns","the","next","set","of","parameters","to","optimise",".","Args",":","ranges_to_skip",":","Explicitly","defines","a","set","of","keys","to","skip","."]
code: def get_next_parameters(self, ranges_to_skip=None):
      """Returns the next set of parameters to optimise.
  
      Args:
        ranges_to_skip: Explicitly defines a set of keys to skip.
      """
      if ranges_to_skip is None:
          ranges_to_skip = set(self.results.index)
  
      if not isinstance(self.param_ranges, dict):
          raise ValueError("Only works for random search!")
  
      param_range_keys = list(self.param_ranges.keys())
      param_range_keys.sort()
  
      def _get_next():
          """Returns next hyperparameter set per try."""
  
          parameters = {
              k: np.random.choice(self.param_ranges[k])
              for k in param_range_keys
          }
  
          # Adds fixed params
          for k in self.fixed_params:
              parameters[k] = self.fixed_params[k]
  
          return parameters
  
      for _ in range(self._max_tries):
          parameters = _get_next()
          name = self._get_name(parameters)
  
          if name not in ranges_to_skip:
              return parameters
  
      raise ValueError(
          "Exceeded max number of hyperparameter searches!!"
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import os
  import shutil
  import libs.utils
  import numpy
  import pandas
label_desc: Use image node_id 8 for calling the HyperparamOptManager obj's underlying member method code with example usage: obj.get_next_parameters(ranges_to_skip) and returns: parameters, parameters