def setUp(self): study_configuration_json = { "goal": "MAXIMIZE", "maxTrials": 5, "maxParallelTrials": 1, "randomInitTrials": 1, "params": [{ "parameterName": "hidden2", "type": "DISCRETE", "feasiblePoints": "8, 16, 32, 64", "scalingType": "LINEAR" }, { "parameterName": "optimizer", "type": "CATEGORICAL", "feasiblePoints": "sgd, adagrad, adam, ftrl", "scalingType": "LINEAR" }] } study_configuration = json.dumps(study_configuration_json) self.study = Study.create("ChocolateGridSearchStudy", study_configuration)
def setUp(self): study_configuration_json = { "goal": "MAXIMIZE", "maxTrials": 5, "maxParallelTrials": 1, "params": [{ "parameterName": "hidden1", "type": "INTEGER", "minValue": 40, "maxValue": 400, "scallingType": "LINEAR" }] } study_configuration = json.dumps(study_configuration_json) self.study = Study.create("RandomSearchStudy", study_configuration) trial1 = Trial.create(self.study.id, "RandomSearchTrial1") trial2 = Trial.create(self.study.id, "RandomSearchTrial2") self.trials = [trial1, trial2] TrialMetric.create(trial1.id, 10, 0.5) TrialMetric.create(trial1.id, 20, 0.6) TrialMetric.create(trial2.id, 10, 0.6) TrialMetric.create(trial2.id, 20, 0.5)
def create_study(self, study_name, study_configuration, algorithm="BayesianOptimization"): study = Study.create(study_name, study_configuration, algorithm) return study
def setUp(self): study_configuration_json = { "goal": "MAXIMIZE", "maxTrials": 5, "maxParallelTrials": 1, "randomInitTrials": 1, "params": [{ "parameterName": "l1_normalization", "type": "DOUBLE", "minValue": 0.01, "maxValue": 0.99, "scalingType": "LINEAR" }, { "parameterName": "learning_rate", "type": "DOUBLE", "minValue": 0.01, "maxValue": 0.5, "scalingType": "LINEAR" }] } study_configuration = json.dumps(study_configuration_json) self.study = Study.create("TpeStudy", study_configuration)
def setUp(self): study_configuration_json = { "goal": "MAXIMIZE", "maxTrials": 5, "maxParallelTrials": 1, "randomInitTrials": 1, "params": [{ "parameterName": "hidden1", "type": "INTEGER", "minValue": 1, "maxValue": 10, "scalingType": "LINEAR" }, { "parameterName": "learning_rate", "type": "DOUBLE", "minValue": 0.01, "maxValue": 0.5, "scalingType": "LINEAR" }] } study_configuration = json.dumps(study_configuration_json) self.study = Study.create("SkoptBayesianOptimizationStudy", study_configuration)
def v1_studies(request): # Create the study if request.method == "POST": data = json.loads(request.body) name = data["name"] study_configuration = json.dumps(data["study_configuration"]) algorithm = data.get("algorithm", "RandomSearchAlgorithm") study = Study.create(name, study_configuration, algorithm) return JsonResponse({"data": study.to_json()}) # List the studies elif request.method == "GET": studies = Study.objects.all() response_data = [study.to_json() for study in studies] return JsonResponse({"data": response_data}) else: return JsonResponse({"error": "Unsupported http method"})
def setUp(self): study_configuration_json = { "goal": "MAXIMIZE", "maxTrials": 5, "maxParallelTrials": 1, "params": [{ "parameterName": "hidden1", "type": "INTEGER", "minValue": 40, "maxValue": 400, "scallingType": "LINEAR" }] } study_configuration = json.dumps(study_configuration_json) self.study = Study.create("GridSearchStudy", study_configuration) self.trials = []
def setUp(self): study_configuration_json = { "goal": "MAXIMIZE", "maxTrials": 5, "maxParallelTrials": 1, "randomInitTrials": 1, "params": [{ "parameterName": "hidden1", "type": "INTEGER", "minValue": 1, "maxValue": 10, "scalingType": "LINEAR" }, { "parameterName": "learning_rate", "type": "DOUBLE", "minValue": 0.01, "maxValue": 0.5, "scalingType": "LINEAR" }, { "parameterName": "hidden2", "type": "DISCRETE", "feasiblePoints": "8, 16, 32, 64", "scalingType": "LINEAR" }, { "parameterName": "optimizer", "type": "CATEGORICAL", "feasiblePoints": "sgd, adagrad, adam, ftrl", "scalingType": "LINEAR" }, { "parameterName": "batch_normalization", "type": "CATEGORICAL", "feasiblePoints": "true, false", "scalingType": "LINEAR" }] } study_configuration = json.dumps(study_configuration_json) self.study = Study.create("RandomSearchStudy", study_configuration)