DEHB#
DEHBBase(cs=None, f=None, dimensions=None, mutation_factor=None, crossover_prob=None, strategy=None, min_fidelity=None, max_fidelity=None, eta=None, min_clip=None, max_clip=None, seed=None, boundary_fix_type='random', max_age=np.inf, **kwargs)
#
Source code in src/dehb/optimizers/dehb.py
get_next_iteration(iteration)
#
Computes the Successive Halving spacing.
Given the iteration index, computes the fidelity spacing to be used and the number of configurations to be used for the SH iterations.
Parameters#
iteration : int Iteration index clip : int, {1, 2, 3, ..., None} If not None, clips the minimum number of configurations to 'clip'
Returns:#
ns : array fidelities : array
Source code in src/dehb/optimizers/dehb.py
get_incumbents()
#
Returns a tuple of the (incumbent configuration, incumbent score/fitness).
DEHB(cs=None, f=None, dimensions=None, mutation_factor=0.5, crossover_prob=0.5, strategy='rand1_bin', min_fidelity=None, max_fidelity=None, eta=3, min_clip=None, max_clip=None, seed=None, configspace=True, boundary_fix_type='random', max_age=np.inf, n_workers=None, client=None, async_strategy='immediate', save_freq='incumbent', resume=False, **kwargs)
#
Bases: DEHBBase
Source code in src/dehb/optimizers/dehb.py
__getstate__()
#
Allows the object to picklable while having Dask client as a class attribute.
Source code in src/dehb/optimizers/dehb.py
__del__()
#
distribute_gpus()
#
Function to create a GPU usage tracker dict.
The idea is to extract the exact GPU device IDs available. During job submission, each submitted job is given a preference of a GPU device ID based on the GPU device with the least number of active running jobs. On retrieval of the result, this gpu usage dict is updated for the device ID that the finished job was mapped to.
Source code in src/dehb/optimizers/dehb.py
clean_inactive_brackets()
#
Removes brackets from the active list if it is done as communicated by Bracket Manager.
Source code in src/dehb/optimizers/dehb.py
is_worker_available(verbose=False)
#
Checks if at least one worker is available to run a job.
Source code in src/dehb/optimizers/dehb.py
ask(n_configs=1)
#
Get the next configuration to run from the optimizer.
The retrieved configuration can then be evaluated by the user.
After evaluation use tell
to report the results back to the optimizer.
For more information, please refer to the description of tell
.
PARAMETER | DESCRIPTION |
---|---|
n_configs |
Number of configs to ask for. Defaults to 1.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
dict or list of dict: Job info(s) of next configuration to evaluate. |
Source code in src/dehb/optimizers/dehb.py
submit_job(job_info, **kwargs)
#
Asks a free worker to run the objective function on config and fidelity.
Source code in src/dehb/optimizers/dehb.py
tell(job_info, result, replay=False)
#
Feed a result back to the optimizer.
In order to correctly interpret the results, the job_info
dict, retrieved by ask
,
has to be given. Moreover, the result
dict has to contain the keys fitness
and cost
.
It is also possible to add the field info
to the result
in order to store additional,
user-specific information.
PARAMETER | DESCRIPTION |
---|---|
job_info |
Job info returned by ask().
TYPE:
|
result |
Result dictionary with mandatory keys
TYPE:
|
Source code in src/dehb/optimizers/dehb.py
965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 |
|
run(fevals=None, brackets=None, total_cost=None, single_node_with_gpus=False, verbose=False, debug=False, **kwargs)
#
Main interface to run optimization by DEHB.
This function waits on workers and if a worker is free, asks for a configuration and a fidelity to evaluate on and submits it to the worker. In each loop, it checks if a job is complete, fetches the results, carries the necessary processing of it asynchronously to the worker computations.
The duration of the DEHB run can be controlled by specifying one of 3 parameters. If more than one are specified, DEHB selects only one in the priority order (high to low): 1) Number of function evaluations (fevals) 2) Number of Successive Halving brackets run under Hyperband (brackets) 3) Total computational cost (in seconds) aggregated by all function evaluations (total_cost)
Source code in src/dehb/optimizers/dehb.py
1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 |
|