Gramacy (2007) Sine Function#
import numpy as np
import matplotlib.pyplot as plt
import uqtestfuns as uqtf
The Gramacy (2007) sine function
(or GramacySine function for short)
is a one-dimensional, 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.
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.
Note
In the original paper, the response of the function is disturbed by an independent identically distributed (i.i.d) Gaussian noise \(\varepsilon \sim \mathcal{N}(0, \sigma_n=0.1)\). The training data is generated from 100 equispaced points in \([0., 20.]\); these points are shown in the above plot.
Test function instance#
To create a default instance of the test function:
my_testfun = uqtf.GramacySine()
Check if it has been correctly instantiated:
print(my_testfun)
Function ID : GramacySine
Input Dimension : 1 (fixed)
Output Dimension : 1
Parameterized : False
Description : One-dimensional sine function from Gramacy (2007)
Applications : metamodeling
Description#
The test function is analytically defined as follows[1]:
where \(x\) is defined below.
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.
Show code cell source
print(my_testfun.prob_input)
Function ID : Gramacy1DSine
Input ID : Gramacy2007
Input Dimension : 1
Description : Input model for the one-dimensional function from Gramacy
(2007)
Marginals :
No. Name Distribution Parameters Description
----- ------ -------------- ------------ -------------
1 x uniform [ 0. 20.] -
References#
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.