mirror of
https://github.com/microsoft/autogen.git
synced 2026-04-20 03:02:16 -04:00
space -> main (#148)
* subspace in flow2 * search space and trainable from AutoML * experimental features: multivariate TPE, grouping, add_evaluated_points * test experimental features * readme * define by run * set time_budget_s for bs Co-authored-by: liususan091219 <Xqq630517> * version * acl * test define_by_run_func * size * constraints Co-authored-by: Chi Wang <wang.chi@microsoft.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
'''Require: pip install flaml[test,ray]
|
||||
'''
|
||||
from flaml.searcher.blendsearch import BlendSearch
|
||||
import time
|
||||
import os
|
||||
from sklearn.model_selection import train_test_split
|
||||
@@ -199,6 +200,28 @@ def test_nested():
|
||||
logger.info(f"CFO best config: {best_trial.config}")
|
||||
logger.info(f"CFO best result: {best_trial.last_result}")
|
||||
|
||||
analysis = tune.run(
|
||||
simple_func,
|
||||
search_alg=BlendSearch(
|
||||
experimental=True,
|
||||
space=search_space, metric="obj", mode="min",
|
||||
low_cost_partial_config={
|
||||
"cost_related": {"a": 1}
|
||||
},
|
||||
points_to_evaluate=[
|
||||
{"b": .99, "cost_related": {"a": 3}},
|
||||
{"b": .99, "cost_related": {"a": 2}},
|
||||
{"cost_related": {"a": 8}}
|
||||
],
|
||||
metric_constraints=[("ab", "<=", 4)]),
|
||||
local_dir='logs/',
|
||||
num_samples=-1,
|
||||
time_budget_s=.1)
|
||||
|
||||
best_trial = analysis.get_best_trial()
|
||||
logger.info(f"BlendSearch exp best config: {best_trial.config}")
|
||||
logger.info(f"BlendSearch exp best result: {best_trial.last_result}")
|
||||
|
||||
analysis = tune.run(
|
||||
simple_func,
|
||||
config=search_space,
|
||||
@@ -222,7 +245,7 @@ def test_run_training_function_return_value():
|
||||
|
||||
# Test dict return value
|
||||
def evaluate_config_dict(config):
|
||||
metric = (round(config['x'])-85000)**2 - config['x']/config['y']
|
||||
metric = (round(config['x']) - 85000)**2 - config['x'] / config['y']
|
||||
return {"metric": metric}
|
||||
|
||||
tune.run(
|
||||
@@ -236,7 +259,7 @@ def test_run_training_function_return_value():
|
||||
|
||||
# Test scalar return value
|
||||
def evaluate_config_scalar(config):
|
||||
metric = (round(config['x'])-85000)**2 - config['x']/config['y']
|
||||
metric = (round(config['x']) - 85000)**2 - config['x'] / config['y']
|
||||
return metric
|
||||
|
||||
tune.run(
|
||||
|
||||
Reference in New Issue
Block a user