PARyOpt package¶
Subpackages¶
Submodules¶
PARyOpt.acquisition_functions module¶
Copyright (c) 2018 Baskar Ganapathysubramanian, Balaji Sesha Sarath Pokuri
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
PARyOpt.acquisition_functions.
expected_improvement
(mean: float, variance: float, curr_best: float = 0.0, _: float = 1.0) → float[source]¶ Expected improvement of objective function ‘A Tutorial on Bayesian Optimization of Expensive Cost Functions, with Application to Active User Modeling and Hierarchical Reinforcement Learning’
Parameters: - mean – mean of surrogate
- variance – variance of surrogate
- curr_best – current best evaluated point
- kappa – exploration - exploitation tradeoff parameter
Returns: expectation of improvement
-
PARyOpt.acquisition_functions.
lower_confidence_bound
(mean: float, variance: float, curr_best: float = 0.0, kappa: float = 1.0) → float[source]¶ lower confidence bound of improvement : used for minimization problems
Parameters: - mean – mean of surrogate
- variance – variance of surrogate
- curr_best – current best evaluated point
- kappa – exploration - exploitation tradeoff parameter
Returns: lower confidence bound
-
PARyOpt.acquisition_functions.
probability_improvement
(mean: float, variance: float, curr_best: float = 0.0, _: float = 1.0) → float[source]¶ Probability of improvement of objective function ‘A Tutorial on Bayesian Optimization of Expensive Cost Functions, with Application to Active User Modeling and Hierarchical Reinforcement Learning’
Parameters: - mean – mean of surrogate
- variance – variance of surrogate
- curr_best – current best evaluated point
- kappa – exploration - exploitation tradeoff parameter
Returns: probability of improvement
-
PARyOpt.acquisition_functions.
upper_confidence_bound
(mean: float, variance: float, curr_best: float = 0.0, kappa: float = 1.0) → float[source]¶ upper confidence bound of improvement: used in the case of maximization problems
Parameters: - mean – mean of surrogate
- variance – variance of surrogate
- curr_best – current best evaluated point
- kappa – exploration - exploitation tradeoff parameter
Returns: upper confidence bound
PARyOpt.PARyOpt module¶
PARyOpt.utils module¶
Copyright (c) 2018 Baskar Ganapathysubramanian, Balaji Sesha Sarath Pokuri
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
PARyOpt.utils.
cdf_normal
(x: <built-in function array>, mean: <built-in function array> = 0.0, sigma_sq: <built-in function array> = 1.0) → float[source]¶ Cumulative distribution function of standard normal distribution
Parameters: - x – scalar / location
- mean – mean of distribution
- sigma_sq – variance of distribution (sigma^2)
Returns: cdf of normal distribution
-
PARyOpt.utils.
distance
(x1: <built-in function array>, x2: <built-in function array>) → float[source]¶ returns the distance between two query points
Parameters: - x1 – point 1
- x2 – point 2
Returns: euclidean distance between the two points
-
PARyOpt.utils.
erf
(x)[source]¶ error function of x: used in calculating cumulative distribution. Unable to import from scipy, so writing our own function
Parameters: x – float Returns: error function of x
-
PARyOpt.utils.
lhs
(n: int, samples: int = None, criterion: str = None, iterations: int = None)[source]¶ Generate a latin-hypercube design
Parameters: - n – The number of factors to generate samples for
- samples – The number of samples to generate for each factor (Default: n)
- criterion – Allowable values are “center” or “c”, “maximin” or “m”, “centermaximin” or “cm”, and “correlation” or “corr”. If no value given, the design is centermaximin.
- iterations – The number of iterations in the maximin and correlations algorithms (Default: 5).
Return H: An n-by-samples design matrix that has been normalized so factor values are uniformly spaced between zero and one.
Example: A 3-factor design (defaults to 3 samples):
>>> lhs(3) array([[ 0.40069325, 0.08118402, 0.69763298], [ 0.19524568, 0.41383587, 0.29947106], [ 0.85341601, 0.75460699, 0.360024 ]])
A 4-factor design with 6 samples:
>>> lhs(4, samples=6) array([[ 0.27226812, 0.02811327, 0.62792445, 0.91988196], [ 0.76945538, 0.43501682, 0.01107457, 0.09583358], [ 0.45702981, 0.76073773, 0.90245401, 0.18773015], [ 0.99342115, 0.85814198, 0.16996665, 0.65069309], [ 0.63092013, 0.22148567, 0.33616859, 0.36332478], [ 0.05276917, 0.5819198 , 0.67194243, 0.78703262]])
A 2-factor design with 5 centered samples:
>>> lhs(2, samples=5, criterion='center') array([[ 0.3, 0.5], [ 0.7, 0.9], [ 0.1, 0.3], [ 0.9, 0.1], [ 0.5, 0.7]])
A 3-factor design with 4 samples where the minimum distance between all samples has been maximized:
>>> lhs(3, samples=4, criterion='maximin') array([[ 0.02642564, 0.55576963, 0.50261649], [ 0.51606589, 0.88933259, 0.34040838], [ 0.98431735, 0.0380364 , 0.01621717], [ 0.40414671, 0.33339132, 0.84845707]])
A 4-factor design with 5 samples where the samples are as uncorrelated as possible (within 10 iterations):
>>> lhs(4, samples=5, criterion='correlate', iterations=10)
-
PARyOpt.utils.
pdf_normal
(x: <built-in function array>, mean: <built-in function array> = 0.0, sigma_sq: float = 1.0) → float[source]¶ Probability distribution function of standard normal distribution, returns the pdf of a location from given mean with variance sigma_sq
Parameters: - x – scalar/location
- mean – mean of distribution
- sigma_sq – variance of distribution (sigma^2)
Returns: pdf of normal distribution
Module contents¶
Copyright (c) 2018 Baskar Ganapathysubramanian, Balaji Sesha Sarath Pokuri
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.