mirror of
https://github.com/microsoft/autogen.git
synced 2025-09-23 15:15:12 +00:00

* console log handler * version update * doc * skippable steps * notebook update * constraint sign * doc for constraints * bug fix: define-by-run and unflatten_hierarchical * const * handle nested space in indexof() * test grid search * test suggestion * model test * >1 ckpts * always increase iter count * log total # iterations * security patch * make iter_per_learner consistent
26 lines
701 B
Python
26 lines
701 B
Python
def test_config_constraint():
|
|
from flaml import tune
|
|
|
|
# Test dict return value
|
|
def evaluate_config_dict(config):
|
|
metric = (round(config["x"]) - 85000) ** 2 - config["x"] / config["y"]
|
|
return {"metric": metric}
|
|
|
|
def config_constraint(config):
|
|
if config["y"] >= config["x"]:
|
|
return 1
|
|
else:
|
|
return 0
|
|
|
|
tune.run(
|
|
evaluate_config_dict,
|
|
config={
|
|
"x": tune.qloguniform(lower=1, upper=100000, q=1),
|
|
"y": tune.qrandint(lower=2, upper=100000, q=2),
|
|
},
|
|
config_constraints=[(config_constraint, ">", 0.5)],
|
|
metric="metric",
|
|
mode="max",
|
|
num_samples=100,
|
|
)
|