Skip to main content

Sample Space Builder

Project description

from sspace import Space, either, eq
import json

space = Space(backend='ConfigSpace')

optim = space.categorical('optimizer', ['sgd', 'adam'])

sgd_lr = space.loguniform('optimizer.lr', 1, 2, quantization=0.01)
sgd_lr.enable_if(either(eq(optim, 'adam'), eq(optim, 'sgd')))
sgd_lr.forbid_equal(1)

for sample in space.sample(2):
    print(sample)

print(json.dumps(space.serialize(), indent=2))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sspace-0.0.0.tar.gz (32.1 kB view hashes)

Uploaded Source

Built Distribution

sspace-0.0.0-py3-none-any.whl (15.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page