Skip to content

A programming framework for agentic AI

clean up

Anonymous-submission-repo0869e9e99a08
diff --git a/flaml/tune/searcher/flow2.py b/flaml/tune/searcher/flow2.py
index 0a11654d9..f07302940 100644
--- a/flaml/tune/searcher/flow2.py
+++ b/flaml/tune/searcher/flow2.py
@@ -49,8 +49,8 @@ class FLOW2(Searcher):
max_resource: Optional[float] = None,
resource_multiple_factor: Optional[float] = None,
cost_attr: Optional[str] = "time_total_s",
- lexico_objectives=None,
seed: Optional[int] = 20,
+ lexico_objectives=None,
):
"""Constructor.
@@ -70,6 +70,7 @@ class FLOW2(Searcher):
resource_multiple_factor: A float of the multiplicative factor
used for increasing resource.
cost_attr: A string of the attribute used for cost.
+ seed: An integer of the random seed.
lexico_objectives: dict, default=None | It specifics information needed to perform multi-objective
optimization with lexicographic preferences. When lexico_objectives is not None, the arguments metric,
mode will be invalid. This dictionary shall contain the following fields of key-value pairs:
@@ -86,7 +87,6 @@ class FLOW2(Searcher):
lexico_objectives = {"metrics":["error_rate","pred_time"], "modes":["min","min"],
"tolerances":{"error_rate":0.01,"pred_time":0.0}, "targets":{"error_rate":0.0}}
```
- seed: An integer of the random seed.
"""
if mode:
assert mode in ["min", "max"], "`mode` must be 'min' or 'max'."
@@ -354,6 +354,7 @@ class FLOW2(Searcher):
def update_fbest(
self,
):
+ # TODO: Improve the efficiency
obj_initial = self.lexico_objectives["metrics"][0]
feasible_index = [*range(len(self._histories[obj_initial]))]
for k_metric in self.lexico_objectives["metrics"]:
diff --git a/flaml/tune/tune.py b/flaml/tune/tune.py
index d6c54bab0..d0ca234c4 100644
--- a/flaml/tune/tune.py
+++ b/flaml/tune/tune.py
@@ -228,8 +228,8 @@ def run(
max_failure: Optional[int] = 100,
use_ray: Optional[bool] = False,
use_incumbent_result_in_evaluation: Optional[bool] = None,
- lexico_objectives: Optional[dict] = None,
log_file_name: Optional[str] = None,
+ lexico_objectives: Optional[dict] = None,
**ray_args,
):
"""The trigger for HPO.
@@ -381,6 +381,11 @@ def run(
max_failure: int | the maximal consecutive number of failures to sample
a trial before the tuning is terminated.
use_ray: A boolean of whether to use ray as the backend.
+ log_file_name: A string of the log file name. Default to None.
+ When set to None:
+ if local_dir is not given, no log file is created;
+ if local_dir is given, the log file name will be autogenerated under local_dir.
+ Only valid when verbose > 0 or use_ray is True.
lexico_objectives: dict, default=None | It specifics information needed to perform multi-objective
optimization with lexicographic preferences. When lexico_objectives is not None, the arguments metric,
mode, will be invalid, and flaml's tune uses CFO
@@ -399,11 +404,6 @@ def run(
lexico_objectives = {"metrics":["error_rate","pred_time"], "modes":["min","min"],
"tolerances":{"error_rate":0.01,"pred_time":0.0}, "targets":{"error_rate":0.0}}
```
- log_file_name: A string of the log file name. Default to None.
- When set to None:
- if local_dir is not given, no log file is created;
- if local_dir is given, the log file name will be autogenerated under local_dir.
- Only valid when verbose > 0 or use_ray is True.
**ray_args: keyword arguments to pass to ray.tune.run().
Only valid when use_ray=True.
"""
diff --git a/website/docs/Use-Cases/Tune-User-Defined-Function.md b/website/docs/Use-Cases/Tune-User-Defined-Function.md
index 4b04f903a..a471b9f6e 100644
--- a/website/docs/Use-Cases/Tune-User-Defined-Function.md
+++ b/website/docs/Use-Cases/Tune-User-Defined-Function.md
@@ -529,13 +529,17 @@ In the following example, we want to minimize `val_loss` and `pred_time` of the
lexico_objectives = {}
lexico_objectives["metrics"] = ["val_loss", "pred_time"]
lexico_objectives["pred_time"] = ["min", "min"]
-lexico_objectives["tolerances"] = {"val_loss": 0.02, "pred_time":0.0}
+lexico_objectives["tolerances"] = {"val_loss": 0.02, "pred_time": 0.0}
lexico_objectives["targets"] = {"val_loss": -float('inf'), "pred_time": -float('inf')}
# provide the lexico_objectives to tune.run
-tune.run(..., search_alg = None, lexico_objectives=lexico_objectives, ...)
+tune.run(..., search_alg=None, lexico_objectives=lexico_objectives, ...)
```
-* NOTE: 1. When lexico_objectives is not None, the arguments metric, mode, will be invalid, and flaml's tune uses CFO as the `search_alg`, which makes the input (if provided) `search_alg' invalid. 2. This is a new feature in version 1.1.0 and subject to change in the future version.*
+NOTE:
+
+1. When lexico_objectives is not None, the arguments metric, mode, will be invalid, and flaml's tune uses CFO as the `search_alg`, which makes the input (if provided) `search_alg' invalid.
+
+2. This is a new feature in version 1.1.0 and subject to change in the future version
## Hyperparameter Optimization Algorithm