core.surrogate module¶
This module handles the surrogate’s training.
-
core.surrogate.max_samples¶ maximum number of training samples above which the training is stopped as unsuccessful
Type: int
-
class
core.surrogate.Surrogate(model)¶ Bases:
objectThe class to define the surrogate.
-
model¶ The model object.
Type: core.Model
-
name¶ Name of the surrogate.
Type: str
-
trained¶ Whether the surrogate is trained.
Type: bool
-
diverging¶ Whether the amount of training samples has exceeded the maximal allowable.
Type: bool
-
hp_optimized¶ Whether the hyperparameters of the surrogate have been optimized.
Type: bool
-
optimized_to_samples¶ Amount of training samples during last hyperparameter optimization.
Type: int
-
reoptimization_ratio¶ Sample increase ratio for reoptimization.
Type: float
-
no_samples¶ Current number of training samples.
Type: int
-
sampling_iterations¶ Number of training iterations.
Type: int
-
convergence_metric¶ Dictionary of convergence metrics.
Type: dict
-
file¶ Path to the training database.
Type: str
-
verification_file¶ Path to the verification database.
Type: str
-
verification¶ Verfication samples.
Type: datamod.get_data
-
data¶ Training samples.
Type: datamod.get_data
-
range_norm¶ Range of validity in normalized coordinates.
Type: np.array
-
surrogates¶ List of cross validation surrogates.
Type: list
-
surrogate¶ Surrogate trained on all available data.
Type: object
-
samples¶ New input samples in the current iteration.
Type: np.array
-
best_hp¶ Optimal hyperparameters.
Type: kerastuner.engine.hyperparameters.HyperParameters
-
accuracy¶ Benchmark accuracy statistics.
Type: dict
-
append_verification()¶ Add verification results to database.
-
check_convergence()¶ Check the convergence of the surrogate’s training.
-
evaluate_samples(verify=False)¶ Wrapper function to call the evaluted problem solver.
Parameters: verify (bool) – whether this is a verification run
-
load_results(verify=False)¶ Wrapper function to load the results from the results file
Parameters: verify (bool) – whether this is a verification run
-
optimize_hyperparameters()¶ Wrapper function to optimize the surrogate’s hyperparameters.
-
plot_response(inputs, output, density=30, constants=None, iteration=None)¶ Plot the model’s response based on the surrogate.
Parameters: - inputs (list) – Input dimensions to plot.
- output (int) – Output dimension to plot.
- density (int) – Sampling density of the reponse plot.
- constants (list) – Values of the fixed input dimensions.
- iteration (int) – Iteration number.
-
reload()¶ Reloads the surrogate.
-
report()¶ Plot the convergence metric and report on the trained surrogate.
-
sample()¶ Wrapper function to obtain the new sample points.
Notes
Be careful with geometric, grows fast. If non-adaptive sampling is used, adaptive must be set to None.
-
save()¶ Saves the surrogate.
-
train()¶ Wrapper function to (re)train the surrogate.
-