Optimization step

This module contains functionality to evaluate the acquisition functions and find their optimum using different approaches. The supported approaches are: - Evaluation on discrete grid - Evaluation using LBFGS optimizer from Scipy - Evaluation using PSO optimizer from PySwarms - Evaluation for single objectives and combined objectives via aggregation functions

PyALAF.optimize_step.step_continous_multi(acquisition_function, opt_method, regression_models, aggregation_function, estimated_observation_y, estimated_observation_y_aggregated, estimated_sample_x, custom_acfn_input, alpha, sampler, lim, dimensions, poly_x, n_jobs, pso_options, rng, n_models, **kwargs)[source]

Evaluating an acquisition function within a continuous intervall with the support for aggregation functions to combine multiple objectives and optimize them together.

Parameters:
  • acquisition_function (str or callable) – Name of the acquisition function or a callable. Choose from: ei, poi, ucb, random, std, ideal, uidal, GSx, GSy, iGS, sGSx, qbc.

  • opt_method (str) – Choose from scipy (using lbfgs algorithm) or PSO (using PySwarms).

  • regression_models (list of scikit-learn model) – Trained scikit-Learn models. One is needed for each objective.

  • aggregation_function (callable) – Function that combines all individual objectives together.

  • estimated_observation_y (nd_array) – Values of the objective for already evaluated data.

  • estimated_observation_y_aggregated (nd_array) – Values of the aggregated objective for already evaluated data.

  • estimated_sample_x (nd_array) – Values of the data points for already evaluated data.

  • custom_acfn_input (dict) – Dictionary that contains which information is used by a custom acquisition function.

  • alpha (float) – Hyperparameter for the acquisition function.

  • sampler (LatinHypercube) – Scipys LatinHypercube object.

  • lim (list) – Boundaries for model evaluation.

  • dimensions (int) – Number of dimensions of the features.

  • poly_x (bool) – Indicates if polynomial features are used. Is a PolynomialFeature object of scikit-learn if Polynomial Features should be used and None otherwise.

  • n_jobs (int) – Number of jobs for PySwarms.

  • pso_options (dict) – Options for PySwarms GlobalBestOptimizer.

  • rng (Numpy Random Number Generator) – Random Number Generator object from numpy.

  • n_models (int) – Number of objectives and models.

Returns:

  • nd_array – Feature values for which the acquisition function has its maximum.

  • float – Value of the found maximum of the acquisition function.

Raises:
  • Exception – Acquisition function not implemented.

  • Exception – Optimization method not implemented.

PyALAF.optimize_step.step_continuous(acquisition_function, opt_method, regression_model, estimated_observation_y, estimated_sample_x, custom_acfn_input, alpha, sampler, lim, dimensions, poly_x, n_jobs, pso_options, rng)[source]

Evaluating an acquisition function within a continuous intervall.

Parameters:
  • acquisition_function (str or callable) – Name of the acquisition function or a callable. Choose from: ei, poi, ucb, random, std, ideal, uidal, GSx, GSy, iGS, sGSx, qbc

  • opt_method (str) – Choose from scipy (using lbfgs algorithm) or PSO (using PySwarms).

  • regression_model (scikit-learn model) – Trained scikit-Learn model

  • estimated_observation_y (nd_array) – Values of the objective for already evaluated data.

  • estimated_sample_x (nd_array) – Values of the data points for already evaluated data.

  • custom_acfn_input (dict) – Dictionary that contains which information is used by a custom acquisition function.

  • alpha (float) – Hyperparameter for the acquisition function.

  • sampler (LatinHypercube) – Scipys LatinHypercube object.

  • lim (list) – Boundaries for model evaluation.

  • dimensions (int) – Number of dimensions of the features.

  • poly_x (bool) – Indicates if polynomial features are used. Is a PolynomialFeature object of scikit-learn if Polynomial Features should be used and None otherwise.

  • n_jobs (int) – Number of jobs for PySwarms.

  • pso_options (dict) – Options for PySwarms GlobalBestOptimizer.

  • rng (Numpy Random Number Generator) – Random Number Generator object from numpy.

Returns:

  • nd_array – Feature values for which the acquisition function has its maximum.

  • float – Value of the found maximum of the acquisition function.

Raises:
  • Exception – Acquisition function not implemented.

  • Exception – Optimization method not implemented.

PyALAF.optimize_step.step_discrete(acquisition_function, estimated_observation_y, alpha, mean, std, n_data, data_indices, pool, custom_acfn_input, rng)[source]

Evaluating an acquisition function on a discrete grid or for discrete values. This is suited for pool-based learning.

Parametersls

acquisition_functionstr or callable

Name of the acquisition function or a callable. Choose from: ei, poi, ucb, random, std, ideal, uidal, GSx, GSy, iGS, sGSx. QBC must implemented separately.

estimated_observation_ynd_array

Values of the objective for already evaluated data.

alphafloat

Hyperparameter for the acquisition function.

meannd_array

Mean of the prediction for all data points.

stdnd_array

Mean of the prediction for all data points.

n_dataint

Number of data points

data_indicesnd_array

Array with indices of already evaluated data points from a pool of data

poolnd_array

Pool of data

custom_acfn_inputdict

Dictionary that contains which information is used by a custom acquisition function.

rngNumpy Random Number Generator

Random Number Generator object from numpy.

returns:

The values of the acquisition function for all data points in the pool.

rtype:

nd_array

raises Exception:

Acquisition function is not implemented.