selector.generators.surrogates.surrogates
This module contains surrogate management functions.
Classes
|
Managing surrogates and related functions. |
- class selector.generators.surrogates.surrogates.SurrogateManager(scenario, seed=False, logger=None)[source]
Bases:
objectManaging surrogates and related functions.
- Parameters:
scenario (selector.scenario.Scenario) – AC scenario.
seed (int) – Random seed.
logger (logging.Logger) – Logger from main loop. Default is None, so no Debug infos.
- ei(surrogate, suggestions, next_instance_set)[source]
Compute expected improvement.
- Parameters:
surrogate (selector.pool.Surrogates) – Key to the surrogate model.
suggestions (list of selector.pool.Configuration) – Suggested configurations.
next_instance_set (list of str) – List of next instances to be run.
- Returns:
ei: Expected improvements for suggestions.
- Return type:
ndarray or list
- pi(surrogate, suggestions, cot, results, next_instance_set)[source]
Compute probability of improvement.
- Parameters:
surrogate (selector.pool.Surrogates) – Key to the surrogate model.
suggestions (list of selector.pool.Configuration) – Suggested configurations.
cot (float) – Timelimit set in AC scenario.
results (dict) – Performances of the configuration on the instance set of the tournament.
next_instance_set (list) – List of next instances to run the tournament on.
- Returns:
pi: Probabilities of improvement.
- Return type:
ndarray
- predict(surrogate, configs, cot, next_instance_set)[source]
Get prediction for mean and variance concerning the points quality.
- Parameters:
surrogate (selector.pool.Surrogates) – Key to the surrogate model.
configs (list of selector.pool.Configuration) – Suggested configurations.
cot (float) – Timelimit set in AC scenario.
next_instance_set (list) – List of next instances to run the tournament on.
- Returns:
[{“Configuartion ID”: {“qual”: mean predicted performance, “var”: variance, “gen”: selector.pool.Generator}}]
- Return type:
list of dict of dict
- suggest(suggestor, scenario, n_samples, data, results, next_instance_set)[source]
Suggest points based on surrogate.
- Parameters:
suggestor (selector.pool.Surrogates) – Key to the surrogate model.
scenario (selector.scenario.Scenario) – AC scenario.
seed (int) – Random seed.
logger (logging.Logger) – Logger from main loop. Default is None, so no Debug infos.
- Returns:
Suggested configurations.
- Return type:
list of selector.pool.Configuration
- update_surr(surrogate, history, configs, results, terminations, ac_runtime=None)[source]
Update surrogate model with runhistory.
- Parameters:
surrogate (selector.pool.Surrogates) – Key to the surrogate model.
history (list of selector.pool.Tournament) – Tournament history.
configs (list of selector.pool.Configuration) – Configurations that participated in the tournament.
results (dict) – Results of the tournament.
terminations (dict) – Information about terminations of runs that occurred.
ac_runtime (int) – Total AC runtime in seconds so far.