sigopt / sigoptlite

Optimize with SigOpt with this standalone SigOpt client driver.
Apache License 2.0
8 stars 1 forks source link

OpenSSF Scorecard

SigOpt-Lite

SigOpt-Lite is an open source tool for locally running a lightweight version of SigOpt. Sigopt-Lite contains all the computation elements of SigOpt-Server, but bypasses the need to set up servers and Docker. SigOpt-Lite gives access to the SigOpt Core Module functionality; to learn more about that, visit the SigOpt documentation. To learn about how to host your own SigOpt server, visit the SigOpt-Server repository or the official SigOpt OSS site (sigopt.org).

Installation

Executing the following command will install both the sigopt client (to interact with SigOpt) and the sigoptlite driver (to run the computations locally).

pip install 'sigopt[lite]'

After that is installed, a SigOpt connection object can be created in Python with the following commands.

from sigopt import Connection
conn = Connection(driver="lite")

From this point, SigOpt Core module functionality can be accessed through conn, following the same patterns as detailed in the SigOpt documentation.

Basic Example

Here is an example of using SigOpt-Lite.

from sigopt import Connection
conn = Connection(driver="lite")
experiment_meta = dict(
  parameters=[
    dict(name="x0", type="double", bounds=dict(min=0, max=1)),
    dict(name="x1", type="int", bounds=dict(min=0, max=10)),
  ],
  metrics=[
    dict(
      name="f",
      objective="minimize",
    )
  ],
  observation_budget=20,
)
e = conn.experiments().create(**experiment_meta)
suggestion = conn.experiments(e.id).suggestions().create()
conn.experiments(e.id).observations().create(
  suggestion=suggestion.id,
  values=[{"name": "f", "value": 2}],
)

More SigOpt examples can be found at the Examples GitHub Repo. Note, some of those examples will not be compatible with SigOpt-Lite, including those using the AI Module.

Compute Mode

SigOpt-Lite supports an alternative computation mode that can generate suggestions with reduced computation burden. You can activate this compute mode at Connection object instantiation.

from sigopt import Connection
conn = Connection(driver="lite", compute_mode="kde_only")

Comparing SigOpt-Lite to Calling api.sigopt.com

To support easy use of SigOpt-Lite, the calling sequences involving the Connection object are meant to match those for connecting with api.sigopt.com (as is directed in the SigOpt documentation). Still, in pursuit of simplicitly and a minimalistic installation, SigOpt-Lite does have some limitations.

Supported API Objects and Endpoints

Sigopt-Lite functionality matches the core module of our hosted SigOpt platform, but only certain API endpoints are available.

Objects Endpoints
Experiment Create, Detail
Suggestion Create
Observation Create, List
Best Assignments Detail

SigOpt-Lite Behavior Limitations

Limitations

The following behavior limitations are strictly enforced in SigOpt-Lite.

Recommended Limitations

The following set of soft limitations are recommended by the SigOpt research team to ensure a pleasant experience using SigOpt-Lite.