Ejemplo n.º 1
0
    def setExperiment(self, experiment):
        parameters = Parameter.parametersToDict(experiment.parameters)

        parameters_linearly_spaced_vals = []

        # parameter start from the lower bound to higher bound
        for idx, parameter in enumerate(experiment.parameters):
            ncpp = self.num_configs_per_param[idx]
            # step_size = (parameter.maximum - parameter.minimum) / (ncpp - 1)
            if ncpp == 1:
                step_size = 0
            else:
                step_size = (parameter.maximum - parameter.minimum) / (ncpp -
                                                                       1)
            parameter_linearly_spaced_vals = [
                parameter.minimum + (i * step_size) for i in range(ncpp)
            ]
            parameter_linearly_spaced_vals = reversed(
                parameter_linearly_spaced_vals)
            parameters_linearly_spaced_vals.append(
                parameter_linearly_spaced_vals)

        # get cartesian product of configs
        parameter_configs_product = itertools.product(
            *parameters_linearly_spaced_vals)
        # create collections of ParameterConfigs from config values
        for parameter_config_collection in parameter_configs_product:
            parameter_configs = []
            for parameter, value in zip(experiment.parameters,
                                        parameter_config_collection):
                parameter_configs.append(
                    ParameterConfig(parameter=parameter, value=value))
            self.grid_parameter_configs.append(parameter_configs)
Ejemplo n.º 2
0
 def setExperiment(self, experiment):
     """
     This is called by the runner after the experiment is properly initialized
     """
     self.parameters_by_name = {parameter.name: parameter for parameter in experiment.parameters}
     self.optimizer = RandomSearchOptimizer(pbounds=Parameter.parametersToDict(experiment.parameters), random_seed=self.random_seed)
     self.experiment_id = experiment.id
     self.previous_trials = experiment.trials
Ejemplo n.º 3
0
 def setExperiment(self, experiment):
     """
 This is called by the runner after the experiment is properly initialized
 """
     self.parameters_by_name = {
         parameter.name: parameter
         for parameter in experiment.parameters
     }
     self.optimizer = BayesianOptimization(
         f=None,
         pbounds=Parameter.parametersToDict(experiment.parameters),
         verbose=2,
         random_state=randint(1, 100),
     )
     self.experiment_id = experiment.id
     self.previous_trials = experiment.trials
Ejemplo n.º 4
0
    def setExperiment(self, experiment):
        parameters = Parameter.parametersToDict(experiment.parameters)
        ncpp = self.num_configs_per_param
        parameters_linearly_spaced_vals = []
        for parameter in experiment.parameters:
            step_size = (parameter.maximum - parameter.minimum) / (ncpp - 1)
            parameter_linearly_spaced_vals = [
                parameter.minimum + (i * step_size) for i in range(ncpp)
            ]
            parameters_linearly_spaced_vals.append(
                parameter_linearly_spaced_vals)

        # get cartesian product of configs
        parameter_configs_product = itertools.product(
            *parameters_linearly_spaced_vals)
        # create collections of ParameterConfigs from config values
        for parameter_config_collection in parameter_configs_product:
            parameter_configs = []
            for parameter, value in zip(experiment.parameters,
                                        parameter_config_collection):
                parameter_configs.append(
                    ParameterConfig(parameter=parameter, value=value))
            self.grid_parameter_configs.append(parameter_configs)