Skip to content

Instantly share code, notes, and snippets.

View amysteier's full-sized avatar

Amy Steier amysteier

View GitHub Profile
for i in range(len(studies)):
study = studies[i]
print("Study " + str(i))
for j in range(len(study.trials)):
state = str(study.trials[j].state)[11:]
if state == "COMPLETE":
sqs = study.trials[j].values[0]
print("\tTrial " + str(j) + " has state " + state + " and SQS " + str(sqs))
else:
print("\tTrial " + str(j) + " has state " + state)
import pandas as pd
datasets = pd.read_csv(dataset_list)
studies = []
for i in range(len(datasets)):
dataset = datasets.loc[i]["filename"]
study_name = study_base_name + str(i)
studies.append(create_study(study_name, dataset, trial_job_cnt, trials_per_job, api_key, storage, sampler))
import subprocess
def create_study(study_name, dataset, trial_job_cnt, trials_per_job, api_key, storage, sampler):
study = optuna.create_study(study_name=study_name,storage=storage, sampler=sampler, direction="maximize")
# Tell Optuna to start with our default config settings
study.enqueue_trial(
{
from smart_open import open
import yaml
with open("https://raw.githubusercontent.com/gretelai/gretel-blueprints/main/config_templates/gretel/synthetics/default.yml", 'r') as stream:
config = yaml.safe_load(stream)
@amysteier
amysteier / gist:21dc1c45d3476810f5f2a143609c1906
Last active December 8, 2021 18:41
Example Optuna objective function
import time
import optuna
from gretel_client import projects
from gretel_client import create_project
from gretel_client.config import RunnerMode
from gretel_client.helpers import poll
def objective(trial: optuna.Trial):