def setup_params(): """ Here you can set up specific parameters for each file in filenames. The output format should be a list of dictionaries. You can either manually make this list of dictionaries or use the helper function add_params which can be seen in use in the default version of this function. """ # At the very least you must return this from the function, # A list of blank dictionaries. param_list = [{}, {}, {}, {}, {}] # This holds which iteration of the main loop you are on # Can be useful to know in some circumstances. param_list = add_params(param_list, "iter", [str(i + 1) for i in range(len(filenames))]) # TODO decide here if you are doing any searching # Leave this as True if you are not doing hyper-param searching # Ignore all the below things if not using hyper-param searching use_hyper_params = True param_list = add_params(param_list, "search", not use_hyper_params) if use_hyper_params: hyper_params = return_hyperparam_list() param_list = add_params(param_list, "objective_args", hyper_params) return param_list
def __init__(self, layout, shift_rate=0, num_sections=10, **kwargs): """ Shifts pixel colors along a hue range in the order that the led strips woulf be laid in period is the number of seconds it takes a color to lap the cube hue_range defines the range of colors used as a prop of the color wheel """ super(Brendo, self).__init__() self.layout = layout self.add_param("num_sections", num_sections, 1, 10) self.add_param("shift_rate", shift_rate, 0, 30) # Travellers traveller_params = { "tr_" + key: value for key, value in travellers.params.items() } standers_params = { "st_" + key: value for key, value in standers.params.items() } add_params(self, traveller_params, strict=False, **kwargs) add_params(self, standers_params, strict=False, **kwargs)
def __init__(self, layout, **kwargs): """ Shifts pixel colors along a hue range in the order that the led strips woulf be laid in period is the number of seconds it takes a color to lap the cube hue_range defines the range of colors used as a prop of the color wheel """ super(Travellers, self).__init__() self.layout = layout add_params(self, params, **kwargs)
def wrapped_fn(request, *args, **kwargs): try: user = authenticate(pk=request.GET["uid"], token=request.GET["token"]) if user: messages.success(request, "Welcome back!") login(request, user) if user or not request.user.is_anonymous: return redirect(utils.add_params(request.get_full_path(), remove={"uid", "token"})) except KeyError: if not request.user.is_anonymous: return view_fn(request, request.user, *args, **kwargs) else: messages.error(request, "You must be logged in to view that page.") return not_logged_in(request)
def wrapped_fn(request, *args, **kwargs): try: user = authenticate(pk=request.GET["uid"], token=request.GET["token"]) if user: messages.success(request, "Welcome back!") login(request, user) if user or not request.user.is_anonymous: return redirect( utils.add_params(request.get_full_path(), remove={"uid", "token"})) except KeyError: if not request.user.is_anonymous: return view_fn(request, request.user, *args, **kwargs) else: messages.error(request, "You must be logged in to view that page.") return not_logged_in(request)
def url_for(self, since=None): params = since and {"since": since.strftime("%Y%m%d")} return utils.add_params(self.url, params)
f.write("{} {}\n".format( os.path.basename(location)[:-3], score)) last_str = "Total score: {}".format(np.sum(np.array(scores))) f.write(last_str) print(last_str) if __name__ == "__main__": """This is where things you should change are.""" # Change the method here to the desired one method = sean_solution use_hyper_params = False filenames = [ "a_example.in", "b_should_be_easy.in", "c_no_hurry.in", "d_metropolis.in", "e_high_bonus.in" ] hyper_params = return_hyperparam_list() parameter_list = [{}, {}, {}, {}, {}] parameter_list = add_params(parameter_list, "num_evals", [5, 40, 20, 10, 2]) parameter_list = add_params(parameter_list, "search", not use_hyper_params) if use_hyper_params: parameter_list = add_params(parameter_list, "objective_args", hyper_params) do = [True, True, True, True, True] seed = 1 main(method, filenames, parameter_list, do, seed)