Documentation

Welcome to the developer documentation for SigOpt. If you have a question you can’t answer, feel free to contact us!
Welcome to the new SigOpt docs! If you're looking for the classic SigOpt documentation then you can find that here. Otherwise, happy optimizing!

Manually create a SigOpt Run

If the CLI or Jupyter Notebook integration isn't right for your use case then you might want to create Runs and Experiments directly with the SigOpt Python Client. To create a Run, just add the following to your code:

run = sigopt.create_run()

With this Run object you can get and set parameter values and log attributes in a similar way as you would when using the CLI:

run.params.learning_rate = 0.1
accuracy = train_my_model(learning_rate=run.params.learning_rate)
run.log_metric("accuracy", accuracy)

Finally, end the Run:

run.end()

For convenience, you can use a Python context manager to end the Run automatically, including when your code raises an exception:

with sigopt.create_run() as run:
  run.params.learning_rate = 0.1
  accuracy = train_my_model(learning_rate=sigopt.params.learning_rate)
  run.log_metric("accuracy", accuracy)

When using an instance of a Run, all client calls can be applied to the instance as seen above.