Skip to content

Commit edcbd3f

Browse files
author
Sarah Krebs
committed
Allow multiple seeds (adapt DeepCAVE runs)
1 parent 5c5edb3 commit edcbd3f

File tree

20 files changed

+15953
-15912
lines changed

20 files changed

+15953
-15912
lines changed

deepcave/runs/__init__.py

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ def get_configs(
396396
Get configurations of the run.
397397
398398
Optionally, only configurations which were evaluated on the passed budget, seed,
399-
and statuses are considered.
399+
and stati are considered.
400400
401401
Parameters
402402
----------
@@ -696,9 +696,11 @@ def get_avg_costs(
696696
"""
697697
Get average costs over all seeds for a config.
698698
699-
Optionally, only configurations which were evaluated on the passed budget and statuses
699+
Optionally, only configurations which were evaluated on the passed budget and stati
700700
are considered.
701701
702+
In case of multi-objective, multiple costs are returned in the form of a list.
703+
702704
Parameters
703705
----------
704706
config_id : int
@@ -739,7 +741,10 @@ def get_costs(
739741
"""
740742
Return the costs of a configuration.
741743
742-
In case of multi-objective, multiple costs are returned.
744+
Optionally, only configurations which were evaluated on the passed budget, seed, and stati
745+
are considered.
746+
747+
In case of multi-objective, multiple costs are returned in the form of a list.
743748
744749
Parameters
745750
----------
@@ -792,8 +797,10 @@ def get_all_costs(
792797
"""
793798
Get all costs in the history with their config ids and seeds.
794799
795-
If set, only configs from the given budget, seed,
796-
and statuses are returned.
800+
Optionally, only configurations which were evaluated on the passed budget, seed, and stati
801+
are considered.
802+
803+
In case of multi-objective, multiple costs are returned in the form of a list.
797804
798805
Parameters
799806
----------
@@ -863,7 +870,7 @@ def get_status(
863870
budget: Optional[Union[int, float]] = None,
864871
) -> Status:
865872
"""
866-
Return the status of a configuration.
873+
Return the status of a trial (i.e. configuration, budget and seed).
867874
868875
Parameters
869876
----------
@@ -913,7 +920,12 @@ def get_incumbent(
913920
selected_ids: Optional[List[int]] = None,
914921
) -> Tuple[Configuration, float]:
915922
"""
916-
Return the incumbent with its normalized cost.
923+
Return the incumbent with its normalized objective value.
924+
925+
The incumbent is the configuration with the lowest normalized objective value.
926+
927+
Optionally, only configurations which were evaluated on the passed budget, seed,
928+
and stati are considered.
917929
918930
Parameters
919931
----------
@@ -924,9 +936,9 @@ def get_incumbent(
924936
seed : Optional[int], optional
925937
Considered seed. If no seed is given, all seeds are considered. By default None.
926938
statuses : Optional[Union[Status, List[Status]]], optional
927-
Considered statuses. If None, all stati are considered. By default None.
939+
Considered stati. If None, all stati are considered. By default None.
928940
selected_ids: Optional[List[int]], optional
929-
If set, only history ids in the list will be considered. This can for example be
941+
If set, only ids in selected_ids will be considered. This can for example be
930942
useful if only ids up to a certain end-time shall be considered. By default None.
931943
932944
Returns
@@ -953,8 +965,8 @@ def get_incumbent(
953965

954966
for config_id, costs in results.items():
955967
# If there are multiple seeds, only configurations evaluated on all seeds are
956-
# considered. From these configurations, the one with the highest average cost
957-
# over the seeds is considered as the incumbent.
968+
# considered. From these configurations, the one with the highest average objective
969+
# value over the seeds is considered as the incumbent.
958970
if max_seed_count > 1:
959971
if len(costs) < max_seed_count:
960972
continue
@@ -1288,7 +1300,7 @@ def get_encoded_data(
12881300
Which seed should be considered. If None, all seeds are considered.
12891301
By default None.
12901302
statuses : Optional[Union[Status, List[Status]]]
1291-
Which statuses should be considered. If None, all statuses are considered.
1303+
Which stati should be considered. If None, all stati are considered.
12921304
By default None.
12931305
specific : bool
12941306
Whether a specific encoding should be used. This encoding is compatible with pyrfr.

deepcave/runs/trial.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class Trial:
2929
The identificator of the configuration.
3030
budget : Union[int, float]
3131
The budget for the trial.
32+
seed: int
33+
The seed for the trial.
3234
costs : List[float]
3335
A list of the costs of the trial.
3436
start_time : float

0 commit comments

Comments
 (0)