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: Updates the results from last optimisation run.
  
  Args:
    parameters: Hyperparameters used in optimisation.
    loss: Validation loss obtained.
    model: Model to serialised if required.
    info: Any ancillary information to tag on to results.
  
  Returns:
    Boolean flag indicating if the model is the best seen so far.
docstr_tok: ["Updates","the","results","from","last","optimisation","run",".","Args",":","parameters",":","Hyperparameters","used","in","optimisation",".","loss",":","Validation","loss","obtained",".","model",":","Model","to","serialised","if","required",".","info",":","Any","ancillary","information","to","tag","on","to","results",".","Returns",":","Boolean","flag","indicating","if","the","model","is","the","best","seen","so","far","."]
code: def update_score(self, parameters, loss, model, info=""):
      """Updates the results from last optimisation run.
  
      Args:
        parameters: Hyperparameters used in optimisation.
        loss: Validation loss obtained.
        model: Model to serialised if required.
        info: Any ancillary information to tag on to results.
  
      Returns:
        Boolean flag indicating if the model is the best seen so far.
      """
  
      if np.isnan(loss):
          loss = np.Inf
  
      if not os.path.isdir(self.hyperparam_folder):
          os.makedirs(self.hyperparam_folder)
  
      name = self._get_name(parameters)
  
      is_optimal = self.results.empty or loss < self.best_score
  
      # save the first model
      if is_optimal:
          # Try saving first, before updating info
          if model is not None:
              print("Optimal model found, updating")
              model.save(self.hyperparam_folder)
          self.best_score = loss
          self.optimal_name = name
  
      self.results[name] = pd.Series({"loss": loss, "info": info})
      self.saved_params[name] = pd.Series(parameters)
  
      self.results.to_csv(
          os.path.join(self.hyperparam_folder, "results.csv")
      )
      self.saved_params.to_csv(
          os.path.join(self.hyperparam_folder, "params.csv")
      )
  
      return is_optimal
  
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 9 for calling the HyperparamOptManager obj's underlying member method code with example usage: obj.update_score(parameters, loss, model, info) and returns: is_optimal