pygpc.testfunctions package#

Submodules#

pygpc.testfunctions.testfunctions module#

class pygpc.testfunctions.testfunctions.Ackley(matlab_model=False)[source]#

Bases: AbstractModel

N-dimensional Ackley function [1][2][3][4]. The Ackley function is widely used for testing optimization algorithms. In its two-dimensional form, as shown in the plot above, it is characterized by a nearly flat outer region, and a large hole at the centre. The function poses a risk for optimization algorithms, particularly hillclimbing algorithms, to be trapped in one of its many local minima.

Recommended variable values are: a = 20, b = 0.2 and c = 0.5*pi.

\[y = -a\exp{\left(-b\sqrt{\frac{1}{d}\sum_{i=1}^{N} x_i^2}\right)} - \exp{\left(\frac{1}{d}\sum_{i=1}^{N} \cos{(cx_i)}\right)} + a + \exp{(1)}\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [-32.768, 32.768]

  • p["xi"] (float or ndarray of float [n_grid]) – i-th parameter defined in [-32.768, 32.768]

  • p["xN"] (float or ndarray of float [n_grid]) – Nth parameter defined in [-32.768, 32.768]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-1.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.BfieldOutsideSphere(matlab_model=False)[source]#

Bases: AbstractModel

Calculates the B-field outside a sphere, does not depend on conductivity after Jarvas (1987). Dipole in SI units, positions in (mm)

Parameters:
  • p["sphere_radius"] (float) – Radius of sphere in (mm)

  • p["dipole_pos"] (ndarray of float [3 x 1]) – Position of dipole in (mm)

  • p["dipole_moment"] (ndarray of float [3 x 1]) – Moment of dipole in (Ams)

  • p["detector_positions"] (ndarray of float [n x 3]) – Position of detectors, must lie outside sphere

Returns:

B – B-fields in detector positions

Return type:

ndarray of float [1 x 3*N]

Notes

simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.BinaryDiscontinuousSphere(matlab_model=False)[source]#

Bases: AbstractModel

N-dimensional testfunction containing a spherical discontinuity. Inside the sphere the output is 2 and outside of the sphere it is 1.

\[\begin{split}y = \begin{cases} 2, & \text{if } \sqrt{\sum_{i=1}^{N}(x_i-0.5)^2} \leq 0.25 \\ 1, & \text{otherwise} \end{cases}\end{split}\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter [0, 1]

  • p["xi"] (float or ndarray of float [n_grid]) – i-th parameter defined in [0, 1]

  • p["xN"] (float or ndarray of float [n_grid]) – Nth parameter [0, 1]

Returns:

y – Output data

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-2.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.BohachevskyFunction1(matlab_model=False)[source]#

Bases: AbstractModel

2-dimensional first Bohachevsky function [1][2]. The Bohachevsky functions all have the same similar bowl shape. The one shown above is the first function.

\[y = x_1^2 + 2x_2^2 - 0.3\cos(3\pi x_1) - 0.4\cos(4\pi x_2) + 0.7\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [-100, 100]

  • p["x2"] (float or ndarray of float [n_grid]) – second parameter defined in [-100, 100]

  • p["xi"] (float or ndarray of float [n_grid]) – i-th parameter defined in [-100, 100]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-3.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.BoothFunction(matlab_model=False)[source]#

Bases: AbstractModel

2-dimensional BoothFunction.[1][2].

\[y = (x_1+2x_2-7)^2+(2x_1+x_2-5)^2\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [-10, 10]

  • p["x2"] (float or ndarray of float [n_grid]) – second parameter defined in [-10, 10]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-4.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.BukinFunctionNumber6(matlab_model=False)[source]#

Bases: AbstractModel

2-dimensional Bukin Function N. 6 [1][2]. The sixth Bukin Function has many local minima, all of which lie in a ridge.

\[y = 100\sqrt{\mid x_2 - 0.01 x_1^2 \mid} + 0.01\mid x_1 + 10 \mid\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [-15, -5]

  • p["x2"] (float or ndarray of float [n_grid]) – second parameter defined in [-3, 3]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-5.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.Cluster3Simple(matlab_model=False)[source]#

Bases: AbstractModel

2-dimensional testfunction containing a spherical and a linear discontinuity.

\[\begin{split}y = \begin{cases} 2, & \text{if } \sqrt{\sum_{i=1}^{N}(x_i-0.5)^2} \leq 0.25 \\ 1, & \text{otherwise} \end{cases}\end{split}\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter [0, 1]

  • p["x2"] (float or ndarray of float [n_grid]) – 2-nd parameter defined in [0, 1]

Returns:

y – Output data

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-6.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.ContinuousDiscontinuousSphere(matlab_model=False)[source]#

Bases: AbstractModel

N-dimensional testfunction containing a spherical discontinuity. Inside the sphere the output corresponds to the ManufactureDecay function (shifted by -2) and outside of the sphere it correspond to the GenzOscillatory testfunction (scaled by 2).

\[\begin{split}y = \begin{cases} \text{ManufactureDecay}(x) - 2, & \text{if } \sqrt{\sum_{i=1}^{N}x_i^2} \leq 0.25 \\ \text{GenzOscillatory}(x) * 2, & \text{otherwise} \end{cases}\end{split}\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter [0, 1]

  • p["xi"] (float or ndarray of float [n_grid]) – i-th parameter defined in [0, 1]

  • p["xN"] (float or ndarray of float [n_grid]) – Nth parameter [0, 1]

Returns:

y – Output data

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-7.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.CrossinTrayFunction(matlab_model=False)[source]#

Bases: AbstractModel

2-dimensional Cross-in-Tray Function [1][2]. The Cross-in-Tray function has multiple global minima. It is shown here with a smaller domain in the second plot, so that its characteristic “cross” will be visible.

\[y = -0.0001\left(\mid\sin(x_1)\sin(x_2)\exp\left(\mid 100-\frac{\sqrt{x_1^2 + x_2^2}}{\pi}\mid\right)\mid + 1\right)^{0.1}\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [-10, 10]

  • p["x2"] (float or ndarray of float [n_grid]) – second parameter defined in [-10, 10]

  • p["xi"] (float or ndarray of float [n_grid]) – i-th parameter defined in [-10, 10]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-8.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.DeJongFunctionFive(matlab_model=False)[source]#

Bases: AbstractModel

2-dimensional DeJong Function Number Five [1][2]. The fifth function of De Jong is multimodal, with very sharp drops on a mainly flat surface.

\[y = \left(0.002+\sum_{i+1}^{25}\frac{1}{i+(x_1-a_{1i})^6+(x_2-a_{2i})^6}\right)^{-1}\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [-65.536, 65.536]

  • p["x2"] (float or ndarray of float [n_grid]) – second parameter defined in [-65.536, 65.536]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-9.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.DiscontinuousRidgeManufactureDecay(matlab_model=False)[source]#

Bases: AbstractModel

N-dimensional testfunction containing a linear discontinuity. On the one side the output corresponds to the Ridge function and on the other side it correspond to the ManufactureDecay testfunction.

\[\begin{split}y = \begin{cases} \text{ManufactureDecay}(x), & \text{if } \sum_{i=1}^{N}x_i \leq 1 \\ \text{Ridge}(x), & \text{otherwise} \end{cases}\end{split}\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter [0, 1]

  • p["xi"] (float or ndarray of float [n_grid]) – i-th parameter defined in [0, 1]

  • p["xN"] (float or ndarray of float [n_grid]) – Nth parameter [0, 1]

Returns:

y – Output data

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-10.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.DiscontinuousRidgeManufactureDecayGenzDiscontinuous(matlab_model=False)[source]#

Bases: AbstractModel

N-dimensional discontinuous test function. The first QOI corresponds to the DiscontinuousRidgeManufactureDecay function and the second QOI to GenzDiscontinuous.

y = DiscontinuousRidgeManufactureDecayGenzDiscontinuous(x)

Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – Parameter 1 [0, 1]

  • p["x2"] (float or ndarray of float [n_grid]) – Parameter 2 [0, 1]

  • p["x3"] (float or ndarray of float [n_grid]) – Parameter 3 [0, 1]

Returns:

y – Output data

Return type:

ndarray of float [n_grid x n_out]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-11.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.DiscontinuousRidgeManufactureDecay_NaN(matlab_model=False)[source]#

Bases: AbstractModel

N-dimensional testfunction containing a linear discontinuity. On the one side the output corresponds to the Ridge function and on the other side it correspond to the ManufactureDecay testfunction.

\[\begin{split}y = \begin{cases} \text{ManufactureDecay}(x), & \text{if } \sum_{i=1}^{N}x_i \leq 1 \\ \text{Ridge}(x), & \text{otherwise} \end{cases}\end{split}\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter [0, 1]

  • p["xi"] (float or ndarray of float [n_grid]) – i-th parameter defined in [0, 1]

  • p["xN"] (float or ndarray of float [n_grid]) – Nth parameter [0, 1]

Returns:

y – Output data

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-12.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.DixonPriceFunction(matlab_model=False)[source]#

Bases: AbstractModel

d-dimensional Dixon-Price Function [1][2].

\[y = (x_1-1)^2+\sum_{i=d}^{2}(2x_{i}^{2}-x_{i-1})^2\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [-10, 10]

  • p["xi"] (float or ndarray of float [n_grid]) – i-th parameter defined in [-10, 10]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-13.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.DropWaveFunction(matlab_model=False)[source]#

Bases: AbstractModel

2-dimensional DropWaveFunction [1][2]. The Drop-Wave function is multimodal and highly complex. The second plot above shows the function on a smaller input domain, to illustrate its characteristic features.

\[y = -\frac{1+\cos\left(12\sqrt{x_1^2+x_2^2}\right)}{0.5(x_1^2+x_2^2)+2}\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [-5.12, 5.12]

  • p["x2"] (float or ndarray of float [n_grid]) – second parameter defined in [-5.12, 5.12]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-14.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.Dummy(matlab_model=False)[source]#

Bases: AbstractModel

Dummy model

Parameters:
  • p["..."] (float or ndarray of float [n_grid]) – Any first parameter

  • p["..."] – Any second parameter

Returns:

y – Any output

Return type:

ndarray of float [n_grid x 1]

simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.ElectrodeModel(matlab_model=False)[source]#

Bases: AbstractModel

Modified version of Randles circuit. This circuit is used to model the impedance of an inert electrode in an electrolyte with a finite Warburg layer. Circuit: -Rs-(Q(Rct-(WRw)))-

Parameters:
  • p["n_Qdl"] (float or ndarray of float [n_grid]) – First parameter defined in [0, Inf]

  • p["Qdl"] (float or ndarray of float [n_grid]) – Second parameter defined in [0, 1]

  • p["n_Qd"] (float or ndarray of float [n_grid]) – Third parameter defined in [0, Inf]

  • p["Qd"] (float or ndarray of float [n_grid]) – Fourth parameter defined in [0, 1]

  • p["Rs"] (float or ndarray of float [n_grid]) – Fifth parameter defined in [0, Inf]

  • p["Rct"] (float or ndarray of float [n_grid]) – Sixth parameter defined in [0, Inf]

  • p["Rd"] (float or ndarray of float [n_grid]) – Seventh parameter defined in [0, Inf]

  • p["w"] (float or ndarray of float [n_w]) – Frequency variable defined in [0, Inf]

Returns:

Z – Output

Return type:

ndarray of float [n_grid x 1]

simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.Franke(matlab_model=False)[source]#

Bases: AbstractModel

Franke function [1] with 2 parameters. It is often used in regression or interpolation analysis. It is defined in the interval [0, 1] x [0, 1]. Hampton and Doostan used in the framework of BASE-PC [2].

\[y = \frac{3}{4} \exp{\left(-\frac{(9 x_1 - 2)^2}{4} - \frac{(9 x_2 - 2)^2}{4}\right)} + \frac{3}{4} \exp{\left(-\frac{(9 x_1 + 1)^2}{49} - \frac{(9 x_2 + 1)}{10}\right)} + \frac{1}{2} \exp{\left(-\frac{(9 x_1 - 7)^2}{4} - \frac{(9 x_2 - 3)^2}{4}\right)} + \frac{1}{5} \exp{\left(-\frac{(9 x_1 - 4)^2}{4} - (9 x_2 - 7)^2\right)}\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter [0, 1]

  • p["x2"] (float or ndarray of float [n_grid]) – Second parameter [0, 1]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-15.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.GFunction(matlab_model=False)[source]#

Bases: AbstractModel

N-dimensional g-function used by Saltelli and Sobol (1995) [1].

This test function is used as an integrand for various numerical estimation methods, including sensitivity analysis methods, because it is fairly complex, and its sensitivity indices can be expressed analytically. The exact value of the integral with this function as an integrand is 1. For each index i, a lower value of a_i indicates a higher importance of the input variable xi.

\[\prod_{i=1}^{N}\frac{|4 x_i - 2| + a_i}{1 + a_i}\]

The recommended values of a_i by Crestaux et al. (2007) [2] are:

\[a_i = \frac{i-2}{2} \quad \mathrm{for\;all} \quad i=1,...,d\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter [0, 1]

  • p["xi"] (float or ndarray of float [n_grid]) – i-th parameter defined in [0, 1]

  • p["xN"] (float or ndarray of float [n_grid]) – Nth parameter [0, 1]

  • p["a"] (ndarray of float [N_dims]) – Importance factors of dimensions

Returns:

y – Output data

Return type:

ndarray of float [N_input x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-16.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.GenzContinuous(matlab_model=False)[source]#

Bases: AbstractModel

N-dimensional “continuous” Genz function [1]. It is defined in the interval [0, 1] x … x [0, 1].

\[y = \exp{\left(- \sum_{i=1}^{N} a_i | x_i - u_i | \right)}\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [0, 1]

  • p["xi"] (float or ndarray of float [n_grid]) – i-th parameter defined in [0, 1]

  • p["xN"] (float or ndarray of float [n_grid]) – Nth parameter defined in [0, 1]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-17.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.GenzCornerPeak(matlab_model=False)[source]#

Bases: AbstractModel

N-dimensional “CornerPeak” Genz function [1,2]. It is defined in the interval [0, 1] x … x [0, 1]. Used by [3] as testfunction.

\[y = \left( 1 + \sum_{i=1}^N a_i x_i\right)^{-(N + 1)}\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [0, 1]

  • p["xi"] (float or ndarray of float [n_grid]) – i-th parameter defined in [0, 1]

  • p["xN"] (float or ndarray of float [n_grid]) – Nth parameter defined in [0, 1]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-18.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.GenzDiscontinuous(matlab_model=False)[source]#

Bases: AbstractModel

N-dimensional “Discontinuous” Genz function [1]. It is defined in the interval [0, 1] x … x [0, 1].

\[y = \exp\left( \sum_{i=1}^N a_i x_i\right) \quad \mathrm{if} \quad x_i < u_i \quad \mathrm{else} \quad 0\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [0, 1]

  • p["xi"] (float or ndarray of float [n_grid]) – i-th parameter defined in [0, 1]

  • p["xN"] (float or ndarray of float [n_grid]) – Nth parameter defined in [0, 1]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-19.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.GenzGaussianPeak(matlab_model=False)[source]#

Bases: AbstractModel

N-dimensional “GaussianPeak” Genz function [1]. It is defined in the interval [0, 1] x … x [0, 1].

\[y = \exp\left( - \sum_{i=1}^{N} a_i ^2 (x_i - u_i)^2\right)\]

By default u_i = 0.5 and a_i = 5.

Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [0, 1]

  • p["xi"] (float or ndarray of float [n_grid]) – i-th parameter defined in [0, 1]

  • p["xN"] (float or ndarray of float [n_grid]) – Nth parameter defined in [0, 1]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-20.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.GenzOscillatory(matlab_model=False)[source]#

Bases: AbstractModel

N-dimensional “Oscillatory” Genz function [1]. It is defined in the interval [0, 1] x … x [0, 1].

\[y = \cos \left( 2 \pi u_1 + \sum_{i=1}^{N}a_i x_i \right)\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [0, 1]

  • p["xi"] (float or ndarray of float [n_grid]) – i-th parameter defined in [0, 1]

  • p["xN"] (float or ndarray of float [n_grid]) – Nth parameter defined in [0, 1]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-21.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.GenzOscillatory_NaN(matlab_model=False)[source]#

Bases: AbstractModel

N-dimensional “Oscillatory” Genz function [1]. It is defined in the interval [0, 1] x … x [0, 1].

\[y = \cos \left( 2 \pi u_1 + \sum_{i=1}^{N}a_i x_i \right)\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [0, 1]

  • p["xi"] (float or ndarray of float [n_grid]) – i-th parameter defined in [0, 1]

  • p["xN"] (float or ndarray of float [n_grid]) – Nth parameter defined in [0, 1]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-22.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.GenzProductPeak(matlab_model=False)[source]#

Bases: AbstractModel

N-dimensional “ProductPeak” Genz function [1]. It is defined in the interval [0, 1] x … x [0, 1].

\[y = \prod_{i=1}^{N} \left( a_i^{-2} + (x_i - u_i)^2 \right)^{-1}\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [0, 1]

  • p["xi"] (float or ndarray of float [n_grid]) – i-th parameter defined in [0, 1]

  • p["xN"] (float or ndarray of float [n_grid]) – Nth parameter defined in [0, 1]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-23.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.GramacyLeeFunction(matlab_model=False)[source]#

Bases: AbstractModel

1-dimensional Gramacy and Lee function[1][2][3]. This is a simple one-dimensional test function.

\[y = \frac{\sin(10 \pi x)}{2x}+(x-1)^4\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [0.5, 2.5]

  • p["x2"] (float or ndarray of float [n_grid]) – second parameter defined in [0.5, 2.5]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-24.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.HyperbolicTangent(matlab_model=False)[source]#

Bases: AbstractModel

Two-dimensional hyperbolic tangent function [1] to simulate discontinuities. Discontinuity at x1 = 0.

\[y(x_1, x_2) = \tanh(10 x_1) + 0.2 \sin(10 x_1) + 0.3 x_2 + 0.1 \sin(5 x_1)\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – Parameter 1 [-1, 1]

  • p["x2"] (float or ndarray of float [n_grid]) – Parameter 2 [-1, 1]

Returns:

y – Output data

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-25.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.Ishigami(matlab_model=False)[source]#

Bases: AbstractModel

Three-dimensional test function of Ishigami.

The Ishigami function of Ishigami & Homma (1990) [1] is used as an example for uncertainty and sensitivity analysis methods, because it exhibits strong nonlinearity and nonmonotonicity. It also has a peculiar dependence on x3, as described by Sobol’ & Levitan (1999) [2]. The values of a and b used by Crestaux et al. (2007) [3] and Marrel et al. (2009) [4] are: a = 7 and b = 0.1.

\[y = \sin(x_1) + a \sin(x_2)^2 + b x_3^4 \sin(x_1)\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [-pi, pi]

  • p["x2"] (float or ndarray of float [n_grid]) – Second parameter defined in [-pi, pi]

  • p["x3"] (float or ndarray of float [n_grid]) – Third parameter defined in [-pi, pi]

  • p["a"] (float) – shape parameter (a=7)

  • p["b"] (float) – shape parameter (b=0.1)

Returns:

y – Output data

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-26.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.Ishigami_NaN(matlab_model=False)[source]#

Bases: AbstractModel

Three-dimensional test function of Ishigami.

The Ishigami function of Ishigami & Homma (1990) [1] is used as an example for uncertainty and sensitivity analysis methods, because it exhibits strong nonlinearity and nonmonotonicity. It also has a peculiar dependence on x3, as described by Sobol’ & Levitan (1999) [2]. The values of a and b used by Crestaux et al. (2007) [3] and Marrel et al. (2009) [4] are: a = 7 and b = 0.1.

\[y = \sin(x_1) + a \sin(x_2)^2 + b x_3^4 \sin(x_1)\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [-pi, pi]

  • p["x2"] (float or ndarray of float [n_grid]) – Second parameter defined in [-pi, pi]

  • p["x3"] (float or ndarray of float [n_grid]) – Third parameter defined in [-pi, pi]

  • p["a"] (float) – shape parameter (a=7)

  • p["b"] (float) – shape parameter (b=0.1)

Returns:

y – Output data

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-27.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.Lim2002(matlab_model=False)[source]#

Bases: AbstractModel

Two-dimensional test function of Lim et al. (2002) [1] (eq. (27)).

This function is a polynomial in two dimensions, with terms up to degree 5. It is nonlinear, and it is smooth despite being complex, which is common for computer experiment functions.

\[y = 9 + \frac{5}{2} x_1 - \frac{35}{2} x_2 + \frac{5}{2} x_1 x_2 + 19 x_2^2 - \frac{15}{2} x_1^3 - \frac{5}{2} x_1 x_2^2 - \frac{11}{2} x_2^4 + x_1^3 x_2^2\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [0, 1]

  • p["x2"] (float or ndarray of float [n_grid]) – Second parameter defined in [0, 1]

Returns:

y – Output data

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-28.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.Lin2Coupled(matlab_model=False)[source]#

Bases: AbstractModel

d-dimensional Lin2Coupled Function. The Lin2Coupled function is continuous, convex and unimodal. The plot shows its two-dimensional form.

\[y = \sum_{i=1}^{d}x_i x_{i+1}\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [-1, 1]

  • p["x2"] (float or ndarray of float [n_grid]) – second parameter defined in [-1, 1]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-29.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.Lorenz_System[source]#

Bases: AbstractModel

Model for the Lorenz System of differential equations. It is nonlinear and shows chaotic behaviour specifically for the three parameter values sigma = 10.0, beta = 28.0 and rho = 8.0/3.0. The lorenz attractor can then be observed in any three dimensional trajectory.

Parameters:
  • p["sigma"] (float or ndarray of float [n_grid]) – Parameter of the system

  • p["beta"] (float or ndarray of float [n_grid]) – Parameter of the system

  • p["rho"] (float or ndarray of float [n_grid]) – Parameter of the system

  • p["y1_0"] (float) – initial value of first variable

  • p["y2_0"] (float) – initial value of second variable

  • p["y3_0"] (float) – initial value of third variable

  • p["t_end"] (float) – the end of the timespan for which the system will be evaluated

  • p["step_size"] (float) – the step size for the time increments during which the system will be evaluated

Returns:

x – Results of x coordinate of the system in time steps, the gPC is conducted for the three parameters sigma, beta and rho

Return type:

ndarray of float [n_grid x n_time_steps]

simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.Lorenz_System_julia(fname_julia=None)[source]#

Bases: AbstractModel

Model for the Lorenz System of differential equations in julia. It is nonlinear and shows chaotic behaviour specifically for the three parameter values sigma = 10.0, beta = 28.0 and rho = 8.0/3.0. The lorenz attractor can then be observed in any three dimensional trajectory.

Parameters:
  • p["sigma"] (float or ndarray of float [n_grid]) – Parameter of the system

  • p["beta"] (float or ndarray of float [n_grid]) – Parameter of the system

  • p["rho"] (float or ndarray of float [n_grid]) – Parameter of the system

  • p["y1_0"] (float) – initial value of first variable

  • p["y2_0"] (float) – initial value of second variable

  • p["y3_0"] (float) – initial value of third variable

  • p["t_end"] (float) – the end of the timespan for which the system will be evaluated

  • p["step_size"] (float) – the step size for the time increments during which the system will be evaluated

Returns:

x – Results of x coordinate of the system in time steps, the gPC is conducted for the three parameters sigma, beta and rho

Return type:

ndarray of float [n_grid x n_time_steps]

simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.ManufactureDecay(matlab_model=False)[source]#

Bases: AbstractModel

N-dimensional manufacture decay function [1]. It is defined in the interval [0, 1] x … x [0, 1]. Hampton and Doostan used in the framework of BASE-PC [1].

\[y = \exp{\left(2 - \sum_{i=1}^{N} x_i \frac{\sin(i+1)}{i + 1}\right)}\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [0, 1]

  • p["xi"] (float or ndarray of float [n_grid]) – i-th parameter defined in [0, 1]

  • p["xN"] (float or ndarray of float [n_grid]) – Nth parameter defined in [0, 1]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-30.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.MatyasFunction(matlab_model=False)[source]#

Bases: AbstractModel

2-dimensional Matyas function [1][2]. The Matyas function has no local minima except the global one.

\[y = 0.26(x_1^2+x_2^2)-0.48x_1x_2\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [-10, 10]

  • p["x2"] (float or ndarray of float [n_grid]) – second parameter defined in [-10, 10]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-31.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.McCormickFunction(matlab_model=False)[source]#

Bases: AbstractModel

2-dimensional McCormick Function [1][2].

\[y = \sin(x_1+x_2)+(x_1-x_2)^2-1.5x_1+2.5x_2+1\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [-1.5, 4]

  • p["x2"] (float or ndarray of float [n_grid]) – second parameter defined in [-3, 4]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-32.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.MichalewiczFunction(matlab_model=False)[source]#

Bases: AbstractModel

d-dimensional Michalewicz function [1][2][3][4]. The Michalewicz function has d! local minima, and it is multimodal. The parameter m defines the steepness of they valleys and ridges; a larger m leads to a more difficult search. The recommended value of m is m = 10. The function’s two-dimensional form is shown in the plot above.

\[y=-\sum_{i=1}^{d}\sin(x_i)\sin^{2m}\left(\frac{i x_i^2}{\pi}\right)\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [0, np.pi]

  • p["xi"] (float or ndarray of float [n_grid]) – i-th parameter defined in [0, np.pi]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-33.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.MovingParticleFrictionForce(matlab_model=False)[source]#

Bases: AbstractModel

Differential equation describing a particle moving under the influence of a potential field and of a friction force [1].

\[\frac{d^2 x}{dt^2} + f \frac{dx}{dt} = -\frac{35}{2} x^3 + \frac{15}{2} x\]

with:

\[x_1 = x\]
\[x_2 = \frac{dx}{dt}\]

we get a system of two 1st order ODE

\[\frac{d x_1}{dt} = x_2\]
\[\frac{d x_2}{dt} = -\frac{35}{2} x_1^3 + \frac{15}{2} x_1 - f x_2\]

Discontinuity at randomly perturbed initial value x0 = X0 + delta_X * xi = 0.05 - 0.2 * 0.25 and two stable fixed points:

\[x = -\sqrt{15/35} \; \mathrm{for} \; \xi < -0.25\]
\[x = +\sqrt{15/35} \; \mathrm{for} \; \xi > -0.25\]

xi is uniform distributed [-1, 1]

Mean value: 0.163663 Standard deviation: 0.633865691

Parameters:

p["xi"] (ndarray of float [1]) – Pertubation xi of initial value x0 (x0 = X0 + xi) [-1, 1]

Returns:

y – x(t=10.)

Return type:

ndarray of float [1 x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-34.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.OakleyOhagan2004(matlab_model=False)[source]#

Bases: AbstractModel

15-dimensional test function of Oakley and O’Hagan (2004) [1].

This function’s a-coefficients are chosen so that 5 of the input variables contribute significantly to the output variance, 5 have a much smaller effect, and the remaining 5 have almost no effect on the output variance.

\[y = \mathbf{a}_1^T\mathbf{x} + \mathbf{a}_2^T \sin(\mathbf{x}) + \mathbf{a}_3^T \cos(\mathbf{x}) + \mathbf{x}^T\mathbf{M}\mathbf{x}\]

The parameter vectors a and matrix M are in /pygpc/pck/data/oakley_ohagan_2004.

Parameters:

p["x1...15"] (ndarray of float [n_grid]) – Input data, xi ~ N(mu=0, sigma=1), for all i = 1, 2,…, 15.

Returns:

y – Output data

Return type:

ndarray of float [N_input x 1]

Notes

simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.Peaks(matlab_model=False)[source]#

Bases: AbstractModel

Three-dimensional peaks function.

\[y = 3(1-x_1)^2 e^{-(x_1^2)-(x_3+1)^2}-10(\frac{x_1}{5}-x_1^3-x_3^5) e^{-x_1^2-x_3^2}- \frac{1}{3} e^{-(x_1+1)^2 - x_3^2} + x_2\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – Parameter 1

  • p["x2"] (float or ndarray of float [n_grid]) – Parameter 2

  • p["x3"] (float or ndarray of float [n_grid]) – Parameter 3

Returns:

  • y (ndarray of float [n_grid x n_out]) – Output data

  • misc (dict or list of dict [n_grid]) – Additional data, will be saved under its keys in the .hdf5 file during gPC simulations for every grid point

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-35.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.Peaks_NaN(matlab_model=False)[source]#

Bases: AbstractModel

Three-dimensional peaks function returning NaN values for certain parameters (for testing).

\[y = 3(1-x_1)^2 e^{-(x_1^2)-(x_3+1)^2}-10(\frac{x_1}{5}-x_1^3-x_3^5) e^{-x_1^2-x_3^2}- \frac{1}{3} e^{-(x_1+1)^2 - x_3^2} + x_2\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – Parameter 1

  • p["x2"] (float or ndarray of float [n_grid]) – Parameter 2

  • p["x3"] (float or ndarray of float [n_grid]) – Parameter 3

Returns:

  • y (ndarray of float [n_grid x n_out]) – Output data

  • misc (dict or list of dict [n_grid]) – Additional data, will be saved under its keys in the .hdf5 file during gPC simulations for every grid point

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-36.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.PermFunction(matlab_model=False)[source]#

Bases: AbstractModel

d-dimensional Perm function 0, D, b (beta) [1][2]. The parameter b (beta) is often assumed to be b=10.

\[y = \sum_{i=1}^{d}\left(\sum_{j=1}^{d}(j + \beta)\left(x_j^i-\frac{1}{j^i}\right)\right)^2\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [-d, d]

  • p["xi"] (float or ndarray of float [n_grid]) – i parameter defined in [-d, d]

  • p["xj"] (float or ndarray of float [n_grid]) – j parameter defined in [-d, d]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-37.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.PotentialDipole3Layers(matlab_model=False)[source]#

Bases: AbstractModel

Calculates the electric potential in a 3-layered sphere caused by a dipole after Ary et al. (1981).

Parameters:
  • p["radii"] (list [3]) – Radius of each of the 3 layers (innermost to outermost) in (mm)

  • p["cond_brain_scalp"] (float) – Conductivity of the brain and scalp layers in (S/m)

  • p["cond_skull"] (float) – Conductivity of the skull layer in (S/m)

  • p["dipole_pos"] (ndarray of float [3 x 1]) – Position of the dipole, in (mm)

  • p["dipole_moment"] (ndarray of float [3 x 1]) – Moment of dipole, in (Cm)

  • p["surface_points"] (ndarray of float [N x 3]) – List of positions where the potential should be calculated in (mm)

Returns:

potential – Values of the electric potential, in (V)

Return type:

ndarray of float [1 x n_out]

Notes

simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.PotentialHomogeneousDipole(matlab_model=False)[source]#

Bases: AbstractModel

Calculates the surface potential generated by a dipole inside a homogeneous conducting sphere after Yao (2000).

Parameters:
  • p["sphere_radius"] (float) – Radius of sphere in (mm)

  • p["conductivity"] (float) – Conductivity of medium in (S/m)

  • p["dipole_pos"] (ndarray of float [3 x 1]) – Position of dipole in (mm)

  • p["dipole_moment"] (ndarray of float [3 x 1]) – Moment of dipole in (Cm)

  • p["detector_positions"] (ndarray of float [n x 3]) – Position of detectors, will be projected into the sphere surface in (mm)

Returns:

potential – Potential at the points

Return type:

ndarray of float [1 x n_out]

Notes

simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.Ridge(matlab_model=False)[source]#

Bases: AbstractModel

N-dimensional “Ridge” function [1] (and also used as testfunction therein). Typically defined in the interval [-4, 4] x … x [-4, 4].

\[y = \sum_{i=1}^{N}x_i + 0.25 \left( \sum_{i=1}^{N}x_i \right)^2 + 0.025 \left( \sum_{i=1}^{N}x_i \right)^3\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in e.g. [-4, 4]

  • p["xi"] (float or ndarray of float [n_grid]) – i-th parameter defined in e.g. [-4, 4]

  • p["xN"] (float or ndarray of float [n_grid]) – Nth parameter defined in e.g. [-4, 4]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-38.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.RosenbrockFunction(matlab_model=False)[source]#

Bases: AbstractModel

d-dimensional Rosenbrock Function [1][2][3][4][5]. The Rosenbrock function, also referred to as the Valley or Banana function, is a popular test problem for gradient-based optimization algorithms. It is shown in the plot above in its two-dimensional form. The function is unimodal, and the global minimum lies in a narrow, parabolic valley. However, even though this valley is easy to find, convergence to the minimum is difficult (Picheny et al., 2012).

\[y = \sum_{i=1}^{d-1}[100(x_{i+1}-x_i^2)^2+(x_i-1)^2]\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [-5, 10]

  • p["xi"] (float or ndarray of float [n_grid]) – i-th parameter defined in [-5, 10]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-39.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.RotatedHyperEllipsoid(matlab_model=False)[source]#

Bases: AbstractModel

d-dimensional Rotated-Hyper Ellipsoid Function [1][2]. The Rotated Hyper-Ellipsoid function is continuous, convex and unimodal. It is an extension of the Axis Parallel Hyper-Ellipsoid function, also referred to as the Sum Squares function. The plot shows its two-dimensional form.

\[y = \sum_{i=1}^{d}\sum_{j=1}^{i}\* x_j^2\]
Parameters:
  • p["xi"] (float or ndarray of float [n_grid]) – i parameter defined in [-65.536, 65.536]

  • p["xj"] (float or ndarray of float [n_grid]) – j parameter defined in [-65.536, 65.536]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-40.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.SchafferFunction4(matlab_model=False)[source]#

Bases: AbstractModel

2-dimensional Schaffer function No. 4. [1][2].

\[y = 0.5+\frac{\cos{(\sin{(\mid x_1^2-x_2^2 \mid )})}-0.5}{(1+0.001(x_1^2+x_2^2))^2}\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [-100, 100]

  • p["x2"] (float or ndarray of float [n_grid]) – second parameter defined in [-100, 100]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-41.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.SixHumpCamelFunction(matlab_model=False)[source]#

Bases: AbstractModel

2-dimensional Six - Hump Camel function [1][2]. The plot on the left shows the six-hump Camel function on its recommended input domain, and the plot on the right shows only a portion of this domain, to allow for easier viewing of the function’s key characteristics. The function has six local minima, two of which are global.

\[y = \left(4 - 2.1x_1^2 + \frac{x_1^4}{3}\right)x_1^2 + x_1x_2 + (-4 + 4x_2^2)x_2^2\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [-3, 3]

  • p["x2"] (float or ndarray of float [n_grid]) – second parameter defined in [-2, 2]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-42.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.SphereFunction(matlab_model=False)[source]#

Bases: AbstractModel

d-dimensional Sphere Function [1][2][3][4]. The Sphere function has d local minima except for the global one. It is continuous, convex and unimodal. The plot shows its two-dimensional form.

\[y = \sum_{i=1}^{d}x_i^2\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [-5.12, 5.12]

  • p["x2"] (float or ndarray of float [n_grid]) – second parameter defined in [-5.12, 5.12]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-43.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.SphereModel(matlab_model=False)[source]#

Bases: AbstractModel

Calculates the electric potential in a 3-layered sphere caused by point-like electrodes after Rush and Driscoll (1969) [1].

Parameters:
  • p["sigma_1"] (float) – Conductivity of the innermost layer, in (S/m)

  • p["sigma_2"] (float) – Conductivity of the intermediate layer, in (S/m)

  • p["sigma_3"] (float) – Conductivity of the outermost layer, in (S/m)

  • p["radii"] (list [3]) – Radius of each of the 3 layers (innermost to outermost), in (mm)

  • p["anode_pos"] (ndarray of float [3 x 1]) – Position of the anode_pos, in (mm)

  • p["cathode_pos"] (ndarray of float [3 x 1]) – Position of cathode_pos, in (mm)

  • p["p"] (ndarray of float [N x 3]) – Positions where the potential should be calculated, in (mm)

Returns:

potential – Values of the electric potential, in (V)

Return type:

ndarray of float [1 x n_out]

Notes

simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.SumOfDifferentPowersFunction(matlab_model=False)[source]#

Bases: AbstractModel

d-dimensional Sum Of Different Powers Function [1][2]. The Sum of Different Powers function is unimodal. It is shown here in its two-dimensional form.

\[y = \sum_{i=1}^{d}\mid x_i \mid ^{i+1}\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [-1, 1]

  • p["xj"] (float or ndarray of float [n_grid]) – j-th parameter defined in [-1, 1]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-44.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.SurfaceCoverageSpecies(matlab_model=False)[source]#

Bases: AbstractModel

Differential equation describing the time-evolution of the surface coverage rho [0, 1] for a given species [1]. This problem has one or two fixed points according to the value of the recombination rate beta and it exhibits smooth dependence on the other parameters. The statistics of the solution at t=1 are investigated considering uncertainties in the initial coverage rho_0 and in the reaction parameter beta. Additionally uncertainty in the surface absorption rate alpha can be considered to make the problem 3-dimensional. Gamma=0.01 denotes the desorption rate.

\[\frac{d\rho}{dt} = \alpha (1 - \rho) - \gamma \rho - \beta (\rho - 1)^2 \rho\]
Parameters:
  • p["rho_0"] (ndarray of float [1]) – Initial value rho(t=0) (uniform distributed [0, 1])

  • p["beta"] (ndarray of float [1]) – Recombination rate (uniform distributed [0, 20])

  • p["alpha"] (ndarray of float [1]) – Surface absorption rate (1 or uniform distributed [0.1, 2])

Returns:

y – rho(t->1)

Return type:

ndarray of float [1 x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-45.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.SurfaceCoverageSpecies_NaN(matlab_model=False)[source]#

Bases: AbstractModel

Differential equation describing the time-evolution of the surface coverage rho [0, 1] for a given species [1]. This problem has one or two fixed points according to the value of the recombination rate beta and it exhibits smooth dependence on the other parameters. The statistics of the solution at t=1 are investigated considering uncertainties in the initial coverage rho_0 and in the reaction parameter beta. Additionally uncertainty in the surface absorption rate alpha can be considered to make the problem 3-dimensional. Gamma=0.01 denotes the desorption rate.

\[\frac{d\rho}{dt} = \alpha (1 - \rho) - \gamma \rho - \beta (\rho - 1)^2 \rho\]
Parameters:
  • p["rho_0"] (ndarray of float [1]) – Initial value rho(t=0) (uniform distributed [0, 1])

  • p["beta"] (ndarray of float [1]) – Recombination rate (uniform distributed [0, 20])

  • p["alpha"] (ndarray of float [1]) – Surface absorption rate (1 or uniform distributed [0.1, 2])

Returns:

y – rho(t->1)

Return type:

ndarray of float [1 x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-46.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.TMSEfieldSphere(matlab_model=False)[source]#

Bases: AbstractModel

Calculate the E-field in a sphere caused by external magnetic dipoles after Heller and van Hulsteyn (1992). The results are independent of conductivity.

Parameters:
  • p["dipole_pos"] (ndarray of float [M x 3]) – Position of dipoles, must be outside sphere

  • p["dipole_moment"] (ndarray of float [m x 3]) – Moment of dipoles

  • p["didt"] (float) – Variation rate of current in the coil

  • p["positions"] (ndarray of float [N x 3]) – Position where fields should be calculated, must lie inside sphere in (mm)

Returns:

E – E-fields at detector positions

Return type:

ndarray of float [1 x 3*N]

Notes

simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.Welch1992(matlab_model=False)[source]#

Bases: AbstractModel

20-dimensional test function of Welch et al. (1992) [1].

For input variable screening purposes, it can be found that some input variables of this function have a very high effect on the output, compared to other input variables. As Welch et al. (1992) [1] point out, interactions and nonlinear effects make this function challenging.

\[ \begin{align}\begin{aligned}y = \frac{5 x_{12}}{1 + x_1} + 5 (x_4 - x_{20})^2 + x_5 + 40 x_{19}^3 + 5 x_{19} + 0.05 x_2 + 0.08 x_3 - 0.03 x_6 + 0.03 x_7 - 0.09 x_9 - 0.01 x_{10} -\\0.07 x_{11} + 0.25 x_{13}^2 - 0.04 x_{14} + 0.06 x_{15} - 0.01 x_{17} - 0.03 x_{18}\end{aligned}\end{align} \]
Parameters:

p["x1...x20"] (float) – Input data, xi ~ U(-0.5, 0.5), for all i = 1,…, 20.

Returns:

y – Output data

Return type:

ndarray of float [n_grid x 1]

Notes

simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.WingWeight(matlab_model=False)[source]#

Bases: AbstractModel

10-dimensional test function which models a light aircraft wing from Forrester et al. (2008) [1]

\[y = \frac{0.036 x_1^{0.758} x_2^{0.0035} x_3}{\cos(x_4)^2)^{0.6}} x_5^{0.006} x_6^{0.04} \left( \frac{100 x_7}{\cos(x_4)}\right)^{-0.3} (x_8 x_9)^{0.49} + x_1 x_{10}\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – x1(Sw) [150, 200]

  • p["x2"] (float or ndarray of float [n_grid]) – x2(Wfw) [220, 300]

  • p["x3"] (float or ndarray of float [n_grid]) – x3(A) [6, 10]

  • p["x4"] (float or ndarray of float [n_grid]) – x4(Lambda) [-10, 10]

  • p["x5"] (float or ndarray of float [n_grid]) – x5(q) [16, 45]

  • p["x6"] (float or ndarray of float [n_grid]) – x6(lambda) [0.5, 1]

  • p["x7"] (float or ndarray of float [n_grid]) – x7(tc) [0.08, 0.18]

  • p["x8"] (float or ndarray of float [n_grid]) – x8(Nz) [2.5, 6]

  • p["x9"] (float or ndarray of float [n_grid]) – x9(Wdg) [1700, 2500]

  • p["x10"] (float or ndarray of float [n_grid]) – x10(Wp) [0.025, 0.08]

Returns:

y – Output data

Return type:

float or ndarray of float [n_grid x 1]

Notes

simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

class pygpc.testfunctions.testfunctions.ZakharovFunction(matlab_model=False)[source]#

Bases: AbstractModel

d-dimensional Zakharov Function [1][2]. The Zakharov function has no local minima except the global one. It is shown here in its two-dimensional form.

\[y = \sum_{i=1}^{d} x_i^2+\left(\sum_{i+1}^{d}0.5ix_i\right)^2+\left(\sum_{i+1}^d0.5ix_i\right)^4\]
Parameters:
  • p["x1"] (float or ndarray of float [n_grid]) – First parameter defined in [-5, 10]

  • p["xi"] (float or ndarray of float [n_grid]) – i-th parameter defined in [-5, 10]

Returns:

y – Output

Return type:

ndarray of float [n_grid x 1]

Notes

(Source code, png, hires.png, pdf)

_images/pygpc-testfunctions-47.png
simulate(process_id=None, matlab_engine=None)[source]#

This abstract method must be implemented by the subclass. It should perform the simulation task depending on the input_values provided to the object on instantiation.

Parameters:
  • process_id (int) – A unique identifier; no two processes of the pool will run concurrently with the same identifier

  • matlab_engine (Matlab engine object) – Matlab engine to run Matlab models

validate()[source]#

This abstract method must be implemented by the subclass. It should perform the validation task depending on the parameters defined in the problem. In cases, the model may not run correctly for some parameter combinations, this function changes the definition of the random parameters and the constants.

pygpc.testfunctions.testfunctions.plot_testfunction(testfunction_name: object, parameters: object, constants: object = None, output_idx: object = 0, plot_3d=True) object[source]#

Plot 1D or 2D testfunctions for documentation.

Parameters:
  • testfunction_name (str) – Name of testfunction AbstractModel class

  • parameters (OrdererdDict) – Dictionary containing the 1D coordinates as ndarrays, where the testfunction is evaluated (will be tensorized)

  • constants (OrderedDict (optional)) – Dictionary containing the (remaining) parameters treated as constants

  • output_idx (int or list of int) – Indices of output quantity to plot

  • plot_3d (bool, optional, default: True) – Plot function in 3d or 2d

Returns:

<plot> – Plot showing the QoI of the testfunction in 1D or 2D

Return type:

matplotlib figure

Module contents#