mirror of
https://github.com/microsoft/FLAML.git
synced 2026-02-09 02:09:16 +08:00
* lint * bump ver * bump ver * fixed circular import --------- Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
33 lines
751 B
Python
33 lines
751 B
Python
from flaml.tune import choice
|
|
from flaml.tune.sample import (
|
|
BaseSampler,
|
|
Domain,
|
|
PolynomialExpansionSet,
|
|
lograndint,
|
|
loguniform,
|
|
qlograndint,
|
|
qloguniform,
|
|
qrandint,
|
|
qrandn,
|
|
quniform,
|
|
randint,
|
|
randn,
|
|
uniform,
|
|
)
|
|
|
|
|
|
def test_sampler():
|
|
print(randn().sample(size=2))
|
|
print(PolynomialExpansionSet(), BaseSampler())
|
|
print(qrandn(2, 10, 2).sample(size=2))
|
|
c = choice([1, 2])
|
|
print(c.domain_str, len(c), c.is_valid(3))
|
|
c = choice([1, 2], order=False)
|
|
print(c.domain_str, len(c), c.ordered)
|
|
i = randint(1, 10)
|
|
print(i.domain_str, i.is_valid(10))
|
|
d = Domain()
|
|
print(d.domain_str, d.is_function())
|
|
d.default_sampler_cls = BaseSampler
|
|
print(d.get_sampler())
|