Sampling policy
neps.optimizers.multi_fidelity.sampling_policy
#
EnsemblePolicy
#
EnsemblePolicy(
pipeline_space: SearchSpace,
inc_type: str = "mutation",
logger=None,
)
Bases: SamplingPolicy
Ensemble of sampling policies including sampling randomly, from prior & incumbent.
PARAMETER | DESCRIPTION |
---|---|
SamplingPolicy |
[description]
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
pipeline_space |
Space in which to search
TYPE:
|
inc_type |
str if "hypersphere", uniformly samples from around the incumbent within its distance from the nearest neighbour in history if "gaussian", samples from a gaussian around the incumbent if "crossover", generates a config by crossover between a random sample and the incumbent if "mutation", generates a config by perturbing each hyperparameter with 50% (mutation_rate=0.5) probability of selecting each hyperparmeter for perturbation, sampling a deviation N(value, mutation_std=0.5))
TYPE:
|
Source code in neps/optimizers/multi_fidelity/sampling_policy.py
sample
#
sample(
inc: SearchSpace = None,
weights: dict[str, float] = None,
*args,
**kwargs
) -> SearchSpace
Samples from the prior with a certain probability
RETURNS | DESCRIPTION |
---|---|
SearchSpace
|
[description]
TYPE:
|
Source code in neps/optimizers/multi_fidelity/sampling_policy.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
|
sample_neighbour
#
Samples a config from around the incumbent
within radius as distance
.
Source code in neps/optimizers/multi_fidelity/sampling_policy.py
FixedPriorPolicy
#
FixedPriorPolicy(
pipeline_space: SearchSpace,
fraction_from_prior: float = 1,
logger=None,
)
Bases: SamplingPolicy
A random policy for sampling configuration, i.e. the default for SH but samples a fixed fraction from the prior.
Source code in neps/optimizers/multi_fidelity/sampling_policy.py
sample
#
sample(*args, **kwargs) -> SearchSpace
Samples from the prior with a certain probabiliyu
RETURNS | DESCRIPTION |
---|---|
SearchSpace
|
[description]
TYPE:
|
Source code in neps/optimizers/multi_fidelity/sampling_policy.py
ModelPolicy
#
ModelPolicy(
pipeline_space: SearchSpace,
surrogate_model: str | Any = "gp",
domain_se_kernel: str = None,
graph_kernels: list = None,
hp_kernels: list = None,
surrogate_model_args: dict = None,
acquisition: str | BaseAcquisition = "EI",
log_prior_weighted: bool = False,
acquisition_sampler: (
str | AcquisitionSampler
) = "random",
patience: int = 100,
logger=None,
)
Bases: SamplingPolicy
A policy for sampling configuration, i.e. the default for SH / hyperband
PARAMETER | DESCRIPTION |
---|---|
SamplingPolicy |
[description]
TYPE:
|
Source code in neps/optimizers/multi_fidelity/sampling_policy.py
sample
#
sample(
active_max_fidelity: int = None,
fidelity: int = None,
**kwargs
) -> SearchSpace
Performs the equivalent of optimizing the acquisition function.
Performs 2 strategies as per the arguments passed
- If fidelity is not None, triggers the case when the surrogate has been
trained jointly with the fidelity dimension, i.e., all observations ever
recorded. In this case, the EI for random samples is evaluated at the
fidelity
where the new sample will be evaluated. The top-10 are selected, and the EI for them is evaluated at the target/mmax fidelity. - If active_max_fidelity is not None, triggers the case when a surrogate is trained per fidelity. In this case, all samples have their fidelity variable set to the same value. This value is same as that of the fidelity value of the configs in the training data.
Source code in neps/optimizers/multi_fidelity/sampling_policy.py
RandomUniformPolicy
#
RandomUniformPolicy(
pipeline_space: SearchSpace, logger=None
)
Bases: SamplingPolicy
A random policy for sampling configuration, i.e. the default for SH / hyperband
PARAMETER | DESCRIPTION |
---|---|
SamplingPolicy |
[description]
TYPE:
|
Source code in neps/optimizers/multi_fidelity/sampling_policy.py
SamplingPolicy
#
SamplingPolicy(
pipeline_space: SearchSpace,
patience: int = 100,
logger=None,
)
Bases: ABC
Base class for implementing a sampling strategy for SH and its subclasses