OpenTURNSPythonFunction¶
- class OpenTURNSPythonFunction(n=0, p=0)¶
Override Function from Python.
- Parameters:
- inputDimpositive int
Dimension of the input vector
- outputDimpositive int
Dimension of the output vector
Methods
Input description accessor.
Input dimension accessor.
Output description accessor.
Output dimension accessor.
setInputDescription
(descIn)Input description accessor.
setOutputDescription
(descOut)Output description accessor.
Notes
- You have to overload the function:
_exec(X): single evaluation, X is a sequence of float, returns a sequence of float
- You can also optionally override these functions:
_exec_sample(X): multiple evaluations, X is a 2-d sequence of float, returns a 2-d sequence of float
_gradient(X): gradient, X is a sequence of float, returns a 2-d sequence of float
_hessian(X): hessian, X is a sequence of float, returns a 3-d sequence of float
Examples
>>> import openturns as ot >>> class FUNC(ot.OpenTURNSPythonFunction): ... def __init__(self): ... super(FUNC, self).__init__(2, 1) ... self.setInputDescription(['R', 'S']) ... self.setOutputDescription(['T']) ... def _exec(self, X): ... Y = [X[0] + X[1]] ... return Y >>> F = FUNC()
Create the associated Function:
>>> func = ot.Function(F)
- __init__(n=0, p=0)¶
- getInputDescription()¶
Input description accessor.
- getInputDimension()¶
Input dimension accessor.
- getOutputDescription()¶
Output description accessor.
- getOutputDimension()¶
Output dimension accessor.
- setInputDescription(descIn)¶
Input description accessor.
- setOutputDescription(descOut)¶
Output description accessor.
Examples using the class¶
Customize your Metropolis-Hastings algorithm
Bayesian calibration of hierarchical fission gas release models