docstr: Function to sample a new configuration
  This function is called inside BOHB to query a new configuration
  
  Parameters:
  -----------
  budget: float
      the budget for which this configuration is scheduled
  
  Returns
  -------
  config
      return a valid configuration with parameters and budget
docstr_tok: ["Function","to","sample","a","new","configuration","This","function","is","called","inside","BOHB","to","query","a","new","configuration","Parameters",":","--","--","--","--","--","-","budget",":","float","the","budget","for","which","this","configuration","is","scheduled","Returns","--","--","--","-","config","return","a","valid","configuration","with","parameters","and","budget"]
code: def get_config(self, budget):
      """Function to sample a new configuration
      This function is called inside BOHB to query a new configuration
  
      Parameters:
      -----------
      budget: float
          the budget for which this configuration is scheduled
  
      Returns
      -------
      config
          return a valid configuration with parameters and budget
      """
      logger.debug("start sampling a new configuration.")
      sample = None
      info_dict = {}
  
      # If no model is available, sample from prior
      # also mix in a fraction of random configs
      if (
          not self.kde_models.keys()
          or np.random.rand() < self.random_fraction
      ):
          sample = self.configspace.sample_configuration()
          info_dict["model_based_pick"] = False
  
      if sample is None:
          sample, info_dict = self.sample_from_largest_budget(info_dict)
  
      sample = ConfigSpace.util.deactivate_inactive_hyperparameters(
          configuration_space=self.configspace,
          configuration=sample.get_dictionary(),
      ).get_dictionary()
  
      logger.debug("done sampling a new configuration.")
      sample["TRIAL_BUDGET"] = budget
      return sample
  
file_path: nni/nni/algorithms/hpo/bohb_advisor/config_generator.py
imports: import logging
  import ConfigSpace
  import ConfigSpace.hyperparameters
  import ConfigSpace.util
  import numpy
  import scipy.stats
  import statsmodels.api
label_desc: Use image node_id 4 for calling the CG_BOHB obj's underlying member method code with example usage: obj.get_config(budget) and returns: sample