-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #425 from damar-wicaksono/dev-331
Add exponential function from Dette & Pepelyshev (2010)
- Loading branch information
Showing
9 changed files
with
230 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
--- | ||
jupytext: | ||
formats: ipynb,md:myst | ||
text_representation: | ||
extension: .md | ||
format_name: myst | ||
format_version: 0.13 | ||
jupytext_version: 1.14.1 | ||
kernelspec: | ||
display_name: Python 3 (ipykernel) | ||
language: python | ||
name: python3 | ||
--- | ||
|
||
(test-functions:dette-exp)= | ||
# Exponential Function from Dette and Pepelyshev (2010) | ||
|
||
```{code-cell} ipython3 | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
import uqtestfuns as uqtf | ||
``` | ||
|
||
The function is a three-dimensional, scalar-valued function that exhibits | ||
asymptotic behavior where the function value approaches zero near the origin | ||
and increases toward a value as the input moves farther away from the origin | ||
in any direction. | ||
|
||
The function appeared in {cite}`Dette2010` as a test function for comparing | ||
different experimental designs in the construction of metamodels. | ||
|
||
## Test function instance | ||
|
||
To create a default instance of the test function: | ||
|
||
```{code-cell} ipython3 | ||
my_testfun = uqtf.DetteExp() | ||
``` | ||
|
||
Check if it has been correctly instantiated: | ||
|
||
```{code-cell} ipython3 | ||
print(my_testfun) | ||
``` | ||
|
||
## Description | ||
|
||
The test function is defined as[^location]: | ||
|
||
$$ | ||
\mathcal{M}(\boldsymbol{x}) = 100 \left[ \exp{\left( -\frac{2}{x_1^{1.75}} \right)} + \exp{\left( -\frac{2}{x_2^{1.5}} \right)} + \exp{\left( -\frac{2}{x_3^{1.25}} \right)} \right], | ||
$$ | ||
|
||
where $\boldsymbol{x} = \left( x_1, x_2, x_3 \right)$ is the three-dimensional | ||
vector of input variables further defined below. | ||
|
||
## Probabilistic input | ||
|
||
The probabilistic input model for the test function is shown below. | ||
|
||
```{code-cell} ipython3 | ||
:tags: [hide-input] | ||
print(my_testfun.prob_input) | ||
``` | ||
|
||
## Reference results | ||
|
||
This section provides several reference results of typical UQ analyses involving | ||
the test function. | ||
|
||
### Sample histogram | ||
|
||
Shown below is the histogram of the output based on $100'000$ random points: | ||
|
||
```{code-cell} ipython3 | ||
:tags: [hide-input] | ||
my_testfun.prob_input.reset_rng(42) | ||
xx_test = my_testfun.prob_input.get_sample(100000) | ||
yy_test = my_testfun(xx_test) | ||
plt.hist(yy_test, bins="auto", color="#8da0cb"); | ||
plt.grid(); | ||
plt.ylabel("Counts [-]"); | ||
plt.xlabel("$\mathcal{M}(X)$"); | ||
plt.gcf().tight_layout(pad=3.0) | ||
plt.gcf().set_dpi(150); | ||
``` | ||
|
||
## References | ||
|
||
```{bibliography} | ||
:style: unsrtalpha | ||
:filter: docname in docnames | ||
``` | ||
|
||
[^location]: see Eq. (4), Section 3.1, p. 424, in {cite}`Dette2010`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
""" | ||
Module with an implementation of the functions from Dette and Pepelyshev (2010) | ||
The paper by Dette and Pepelyshev [1] contains several analytical test | ||
functions used to compare different experimental designs for metamodeling | ||
applications. | ||
References | ||
---------- | ||
1. H. Dette and A. Pepelyshev, “Generalized Latin Hypercube Design for Computer | ||
Experiments,” Technometrics, vol. 52, no. 4, pp. 421–429, 2010. | ||
DOI: 10.1198/TECH.2010.09157. | ||
""" | ||
|
||
import numpy as np | ||
|
||
from uqtestfuns.core.custom_typing import ProbInputSpecs | ||
from uqtestfuns.core.uqtestfun_abc import UQTestFunFixDimABC | ||
|
||
__all__ = ["DetteExp"] | ||
|
||
|
||
def evaluate_exp(xx: np.ndarray) -> np.ndarray: | ||
"""Evaluate the exponential function from Dette and Pepelyshev (2010). | ||
Parameters | ||
---------- | ||
xx : np.ndarray | ||
M-Dimensional input values given by an N-by-3 array where | ||
N is the number of input values. | ||
Returns | ||
------- | ||
np.ndarray | ||
The output of the test function evaluated on the input values. | ||
The output is a 1-dimensional array of length N. | ||
""" | ||
yy = np.sum(np.exp(-2 / xx ** ([1.75, 1.5, 1.25])), axis=1) | ||
|
||
return 100 * yy | ||
|
||
|
||
class DetteExp(UQTestFunFixDimABC): | ||
"""A concrete implementation of the exponential function.""" | ||
|
||
_tags = ["metamodeling"] | ||
_description = "Exponential function from Dette and Pepelyshev (2010)" | ||
_available_inputs: ProbInputSpecs = { | ||
"Dette2010": { | ||
"function_id": "DetteExp", | ||
"description": ( | ||
"Input specification for the exponential test function " | ||
"from Dette and Pepelyshev et al. (2010)" | ||
), | ||
"marginals": [ | ||
{ | ||
"name": f"x_{i + 1}", | ||
"distribution": "uniform", | ||
"parameters": [0, 1], | ||
"description": None, | ||
} | ||
for i in range(3) | ||
], | ||
"copulas": None, | ||
}, | ||
} | ||
_available_parameters = None | ||
|
||
evaluate = staticmethod(evaluate_exp) # type: ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters