Skip to content

Commit b83c8a7

Browse files
Pass cost_attr and cost_budget from flaml.tune.run() to the search algo (#1382)
1 parent b9194cd commit b83c8a7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

flaml/tune/tune.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@ def run(
260260
mlflow_exp_name: Optional[str] = None,
261261
automl_info: Optional[Tuple[float]] = None,
262262
extra_tag: Optional[dict] = None,
263+
cost_attr: Optional[str] = "auto",
264+
cost_budget: Optional[float] = None,
263265
**ray_args,
264266
):
265267
"""The function-based way of performing HPO.
@@ -462,6 +464,12 @@ def easy_objective(config):
462464
overwritten by the value of `n_concurrent_trials` in AutoML. When <= 0, the concurrent trials
463465
will be set to the number of executors.
464466
extra_tag: dict, default=None | Extra tags to be added to the mlflow runs created by autologging.
467+
cost_attr: None or str to specify the attribute to evaluate the cost of different trials.
468+
Default is "auto", which means that we will automatically choose the cost attribute to use (depending
469+
on the nature of the resource budget). When cost_attr is set to None, cost differences between different trials will be omitted
470+
in our search algorithm. When cost_attr is set to a str different from "auto" and "time_total_s",
471+
this cost_attr must be available in the result dict of the trial.
472+
cost_budget: A float of the cost budget. Only valid when cost_attr is a str different from "auto" and "time_total_s".
465473
**ray_args: keyword arguments to pass to ray.tune.run().
466474
Only valid when use_ray=True.
467475
"""
@@ -600,6 +608,8 @@ def easy_objective(config):
600608
metric_constraints=metric_constraints,
601609
use_incumbent_result_in_evaluation=use_incumbent_result_in_evaluation,
602610
lexico_objectives=lexico_objectives,
611+
cost_attr=cost_attr,
612+
cost_budget=cost_budget,
603613
)
604614
else:
605615
if metric is None or mode is None:

0 commit comments

Comments
 (0)