RandomOptimizer
RandomOptimizer
#
Bases: Optimizer
A basic implementation of a random search optimizer.
Parameters:
-
cs
(ConfigurationSpace
) –Configuration space object.
-
max_fidelity
(int
) –Maximum fidelity level.
-
n
(int
) –Number of configurations to sample.
-
patience
(int
, default:None
) –Determines if early stopping should be applied for a single configuration. If the score does not improve for
patience
steps, the configuration is stopped. Defaults to None. -
tol
(float
, default:0.0
) –Tolerance for early stopping. Training stops if the score does not improve by at least
tol
forpatience
iterations (if set). Values must be in the range[0.0, inf)
. Defaults to 0.0. -
score_thresh
(float
, default:0.0
) –Score threshold for early stopping. Defaults to 0.0.
-
path
(str
, default:None
) –Path to save the optimizer. Defaults to None.
-
seed
(int
, default:None
) –Random seed. Defaults to None.
-
verbosity
(int
, default:2
) –Verbosity level. Defaults to 2.
Source code in src/qtt/optimizers/random.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
|
ante()
#
This method is intended for the use with a tuner. It allows to perform some pre-processing steps before each ask.
load(path, reset_paths=True, verbose=True)
classmethod
#
Loads the model from disk to memory.
Parameters:
-
path
(str
) –Path to the saved model, minus the file name. This should generally be a directory path ending with a '/' character (or appropriate path separator value depending on OS). The model file is typically located in os.path.join(path, cls.model_file_name).
-
reset_paths
(bool
, default:True
) –Whether to reset the self.path value of the loaded model to be equal to path. It is highly recommended to keep this value as True unless accessing the original self.path value is important. If False, the actual valid path and self.path may differ, leading to strange behaviour and potential exceptions if the model needs to load any other files at a later time.
-
verbose
(bool
, default:True
) –Whether to log the location of the loaded file.
Returns:
-
model
(Optimizer
) –The loaded model object.
Source code in src/qtt/optimizers/optimizer.py
post()
#
This method is intended for the use with a tuner. It allows to perform some post-processing steps after each tell.
reset_path(path=None)
#
Reset the path of the model.
Parameters:
-
path
(str
, default:None
) –Directory location to store all outputs. If None, a new unique time-stamped directory is chosen.
Source code in src/qtt/optimizers/optimizer.py
save(path=None, verbose=True)
#
Saves the model to disk.
Parameters:
-
path
(str
, default:None
) –Path to the saved model, minus the file name. This should generally be a directory path ending with a '/' character (or appropriate path separator value depending on OS). If None, self.path is used. The final model file is typically saved to os.path.join(path, self.model_file_name).
-
verbose
(bool
, default:True
) –Whether to log the location of the saved file.
Returns:
-
str
(str
) –Path to the saved model, minus the file name. Use this value to load the model from disk via cls.load(path), where cls is the class of the model object (e.g., model = Model.load(path)).