(self, budget)
return sample.get_dictionary(), info_dict
Function to sample a new configuration

			This function is called inside Hyperband to query a new configuration


			Parameters:
			-----------
			budget: float
				the budget for which this configuration is scheduled

			returns: config
				should return a valid configuration
Function to sample a new configuration
Function to sample a new configuration
def get_config(self, budget):
		"""
			Function to sample a new configuration

			This function is called inside Hyperband to query a new configuration


			Parameters:
			-----------
			budget: float
				the budget for which this configuration is scheduled

			returns: config
				should return a valid configuration

		"""
		sample = None
		info_dict = {}
		
		# If no model is available, sample from prior
		# also mix in a fraction of random configs
		if len(self.kde_models.keys()) == 0 or np.random.rand() < self.random_fraction:
			sample =  self.configspace.sample_configuration()
			info_dict['model_based_pick'] = False


		if sample is None:
			try:
				#import pdb; pdb.set_trace()
				samples = self.kde_models[budget]['good'].sample(self.num_samples)
				ei = self.kde_models[budget]['good'].pdf(samples)/self.kde_models[budget]['bad'].pdf(samples)
				
				best_idx = np.argmax(ei)
				best_vector = samples[best_idx]

				sample = ConfigSpace.Configuration(self.configspace, vector=best_vector)


				sample = ConfigSpace.util.deactivate_inactive_hyperparameters(
							configuration_space=self.configspace,
							configuration=sample.get_dictionary()
							)
				info_dict['model_based_pick'] = True

			except Exception as e:
				self.logger.warning(("="*50 + "\n")*3 +\
						"Error sampling a configuration!\n"+\
						"Models for budgets: %s"%(self.kde_models.keys()) +\
						"\n here is a traceback:" +\
						traceback.format_exc())

				for b,l in self.losses.items():
					self.logger.debug("budget: {}\nlosses:{}".format(b,l))
				
				sample =  self.configspace.sample_configuration()
				info_dict['model_based_pick'] = False
				
		return sample.get_dictionary(), info_dict
def get_config ( self , budget ) : sample = None info_dict = { } # If no model is available, sample from prior # also mix in a fraction of random configs if len ( self . kde_models . keys ( ) ) == 0 or np . random . rand ( ) < self . random_fraction : sample = self . configspace . sample_configuration ( ) info_dict [ 'model_based_pick' ] = False if sample is None : try : #import pdb; pdb.set_trace() samples = self . kde_models [ budget ] [ 'good' ] . sample ( self . num_samples ) ei = self . kde_models [ budget ] [ 'good' ] . pdf ( samples ) / self . kde_models [ budget ] [ 'bad' ] . pdf ( samples ) best_idx = np . argmax ( ei ) best_vector = samples [ best_idx ] sample = ConfigSpace . Configuration ( self . configspace , vector = best_vector ) sample = ConfigSpace . util . deactivate_inactive_hyperparameters ( configuration_space = self . configspace , configuration = sample . get_dictionary ( ) ) info_dict [ 'model_based_pick' ] = True except Exception as e : self . logger . warning ( ( "=" * 50 + "\n" ) * 3 + "Error sampling a configuration!\n" + "Models for budgets: %s" % ( self . kde_models . keys ( ) ) + "\n here is a traceback:" + traceback . format_exc ( ) ) for b , l in self . losses . items ( ) : self . logger . debug ( "budget: {}\nlosses:{}" . format ( b , l ) ) sample = self . configspace . sample_configuration ( ) info_dict [ 'model_based_pick' ] = False return sample . get_dictionary ( ) , info_dict