Gramacy (2007) One-dimensional (1D) Sine Function
Contents
Gramacy (2007) One-dimensional (1D) Sine Function#
import numpy as np
import matplotlib.pyplot as plt
import uqtestfuns as uqtf
The Gramacy (2007) one-dimensional (1D) sine function
(or Gramacy1DSine
function for short)
is a scalar-valued function that features two regimes: one part is a mixture
of sines and cosines, and another part is a linear function.
The function was introduced in [Gra07] in the context of
metamodeling with non-stationary Gaussian processes.
In the original paper, the response of the function is disturbed by an independent identically distributed (i.i.d) Gaussian noise.
A plot of the function is shown below for \(x \in [0, 20]\).
Note that the function is discontinuous at \(x = 9.6%\) which also pinpoints the change of regime.
Test function instance#
To create a default instance of the test function:
my_testfun = uqtf.Gramacy1DSine()
Check if it has been correctly instantiated:
print(my_testfun)
Name : Gramacy1DSine
Spatial dimension : 1
Description : One-dimensional sine function from Gramacy (2007)
Description#
The test function is analytically defined as follows1:
where \(x\) is defined below.
The response of the function is disturbed by an i.i.d Gaussian noise, such that:
where \(\varepsilon \sim \mathcal{N}(0, \sigma_n = 0.1)\).
Probabilistic input#
Based on [Gra07], the domain of the function is \([0, 20]\). This input can be modeled with a single uniform random variable shown below.
my_testfun.prob_input
Name: Gramacy2007
Spatial Dimension: 1
Description: Input model for the one-dimensional function from Gramacy (2007)
Marginals:
No. | Name | Distribution | Parameters | Description |
---|---|---|---|---|
1 | x | uniform | [ 0. 20.] | None |
Copulas: None
Parameters#
The parameters of the test function is a NumPy random number generator with which the Gaussian random noise is generated. Other available parameters are shown in the table below.
No. |
Value |
Keyword |
Source |
---|---|---|---|
1 |
\(\varepsilon \sim \mathcal{N}(0, \sigma_n=0.1)\) |
|
[Gra07] |
2 |
\(\varepsilon = 0\) |
|
Alternatively, to create an instance of the Gramacy1DSine
function with
different parameters, type
my_testfun = uqtf.Gramacy1DSine(parameters_selection="noiseless")
Note
To use a custom random number generator (perhaps with a fixed seed number), create a default test function and use the custom generator as the parameters after the instance has been created. For example:
my_testfun = uqtf.Gramacy1DSine()
my_rng = np.random.default_rng(322345)
my_testfun.parameters = my_rng
References#
- Gra07(1,2,3,4)
Robert B. Gramacy. tgp: an R package for Bayesian nonstationary, semiparametric nonlinear regression and design by Treed Gaussian Process models. Journal of Statistical Software, 2007. doi:10.18637/jss.v019.i09.