original_docstring:  Run all experiments in sequence, changing the alterations from the prior base configuration. 
docstring: Run all experiments in sequence, changing the alterations from the prior base configuration.
docstring_tokens: Run all experiments in sequence changing the alterations from the prior base configuration .
code: def experiences(self, max_iterations=999999999999, n_trials=15):
          """ Run all experiments in sequence, changing the alterations from the prior base configuration. """
          i = 0
          for experiment_config in self.base_config["experiments"]:
              def objective(trial):
                  for variable_name, variable_params in self.test_variables.items():
                      suggested_values = variable_params["suggested_values"]
                      x = trial.suggest_float(variable_name, suggested_values[0], suggested_values[1])
                      set_value_in_dict_with_path(current_config, variable_params["path"], x)
  
                  exp = Experience(current_config, current_log_path)
                  performance = exp.loop(max_iterations=max_iterations)
                  exp.finish()
                  return performance
  
              current_log_path = os.path.join(self.log_path, str(i))
              if os.path.isdir(current_log_path):
                  shutil.rmtree(current_log_path)
              os.makedirs(current_log_path)
              current_config = copy.deepcopy(self.base_config["base_configs"])
              for field, value in experiment_config["config_alterations"].items():
                  current_config[field] = value
              with open(os.path.join(current_log_path,"config.json"), 'w') as j:
                  json.dump(current_config, j)
              self.test_variables = {}
              for stack in experiment_config["values"]:
                  for variable, suggested_values in stack["values"].items():
                      self.test_variables[stack["prefix"] + variable] = {
                          "current_value" : None,
                          "path" : stack["path"] + [variable],
                          "suggested_values" : suggested_values
                      }
              study = optuna.create_study(direction='minimize')
              study.optimize(objective, n_trials=15)
              study.best_params  # E.g. {'x': 2.002108042}
              print(study.best_params)
              i += 1
code_tokens: def experiences ( self , max_iterations = 999999999999 , n_trials = 15 ) : i = 0 for experiment_config in self . base_config [ "experiments" ] : def objective ( trial ) : for variable_name , variable_params in self . test_variables . items ( ) : suggested_values = variable_params [ "suggested_values" ] x = trial . suggest_float ( variable_name , suggested_values [ 0 ] , suggested_values [ 1 ] ) set_value_in_dict_with_path ( current_config , variable_params [ "path" ] , x ) exp = Experience ( current_config , current_log_path ) performance = exp . loop ( max_iterations = max_iterations ) exp . finish ( ) return performance current_log_path = os . path . join ( self . log_path , str ( i ) ) if os . path . isdir ( current_log_path ) : shutil . rmtree ( current_log_path ) os . makedirs ( current_log_path ) current_config = copy . deepcopy ( self . base_config [ "base_configs" ] ) for field , value in experiment_config [ "config_alterations" ] . items ( ) : current_config [ field ] = value with open ( os . path . join ( current_log_path , "config.json" ) , 'w' ) as j : json . dump ( current_config , j ) self . test_variables = { } for stack in experiment_config [ "values" ] : for variable , suggested_values in stack [ "values" ] . items ( ) : self . test_variables [ stack [ "prefix" ] + variable ] = { "current_value" : None , "path" : stack [ "path" ] + [ variable ] , "suggested_values" : suggested_values } study = optuna . create_study ( direction = 'minimize' ) study . optimize ( objective , n_trials = 15 ) study . best_params print ( study . best_params ) i += 1
short_docstring: Run all experiments in sequence, changing the alterations from the prior base configuration.
short_docstring_tokens: Run all experiments in sequence changing the alterations from the prior base configuration .
comment: """ Run all experiments in sequence, changing the alterations from the prior base configuration. """$SEP$# E.g. {'x': 2.002108042}