1%feature("docstring") OT::MetaModelValidation
2"Base class to score a metamodel and perform validations.
3
4Refer to :ref:`cross_validation`.
5
6Parameters
7----------
8inputValidationSample, outputValidationSample : 2-d sequence of float
9    The input and output validation samples, not used during the learning step.
10
11metaModel : :class:`~openturns.Function`
12    Metamodel to validate.
13
14Notes
15-----
16A MetaModelValidation object is used for the validation process of a metamodel.
17For that purpose, a dataset independent of the learning step, is used to score the surrogate model.
18Its main functionalities are :
19
20- To compute the predictivity factor :math:`Q_2`
21- To get the residual sample, its non parametric distribution
22- To draw a `model vs metamodel` validation graph.
23
24
25Currently only one dimensional output models are available.
26
27Examples
28--------
29>>> import openturns as ot
30>>> from math import pi
31>>> dist = ot.Uniform(-pi/2, pi/2)
32>>> # Model here is sin(x)
33>>> model = ot.SymbolicFunction(['x'], ['sin(x)'])
34>>> # We can build several types of models (kriging, pc, ...)
35>>> # We use a Taylor developement (order 5) and compare the metamodel with the model
36>>> metaModel = ot.SymbolicFunction(['x'], ['x - x^3/6.0 + x^5/120.0'])
37>>> x = dist.getSample(10)
38>>> y = model(x)
39>>> # Validation of the model
40>>> val = ot.MetaModelValidation(x, y, metaModel)
41>>> # Compute the first indicator : q2
42>>> q2 = val.computePredictivityFactor()
43>>> # Get the residual
44>>> residual = val.getResidualSample()
45>>> # Get the histogram of residual
46>>> histoResidual = val.getResidualDistribution(False)
47>>> # Draw the validation graph
48>>> graph = val.drawValidation()
49"
50
51// ---------------------------------------------------------------------
52
53%feature("docstring") OT::MetaModelValidation::getInputSample
54"Accessor to the input sample.
55
56Returns
57-------
58inputSample : :class:`~openturns.Sample`
59    Input sample of a model evaluated apart."
60
61// ---------------------------------------------------------------------
62
63%feature("docstring") OT::MetaModelValidation::getOutputSample
64"Accessor to the output sample.
65
66Returns
67-------
68outputSample : :class:`~openturns.Sample`
69    Output sample of a model evaluated apart."
70
71// ---------------------------------------------------------------------
72
73%feature("docstring") OT::MetaModelValidation::computePredictivityFactor
74"Compute the predictivity factor.
75
76Returns
77-------
78q2 : :class:`~openturns.Point`
79    The predictivity factor
80
81Notes
82-----
83The predictivity factor :math:`Q_2` is given by :
84
85.. math::
86    Q_2 = 1 - \frac{\sum_{l=1}^{N} (Y_{l} -\hat{f}(X_l))^2}{N \cdot Var(Y)}"
87
88// ---------------------------------------------------------------------
89
90%feature("docstring") OT::MetaModelValidation::getResidualSample
91"Compute the residual sample.
92
93Returns
94-------
95residual : :class:`~openturns.Sample`
96    The residual sample.
97
98Notes
99-----
100The residual sample is given by :
101
102.. math::
103    \epsilon_{l} = Y_{l} -\hat{f}(X_l)"
104
105
106// ---------------------------------------------------------------------
107
108%feature("docstring") OT::MetaModelValidation::getResidualDistribution
109"Compute the non parametric distribution of the residual sample.
110
111Parameters
112----------
113smooth : bool
114    Tells if distribution is smooth (true) or not.
115    Default argument is true.
116
117Returns
118-------
119residualDistribution : :class:`~openturns.Distribution`
120    The residual distribution.
121
122Notes
123-----
124The residual distribution is built thanks to :class:`~openturns.KernelSmoothing` if `smooth` argument is true. Otherwise, an histogram distribution is returned, thanks to :class:`~openturns.HistogramFactory`."
125
126
127// ---------------------------------------------------------------------
128
129%feature("docstring") OT::MetaModelValidation::drawValidation
130"Plot a model vs metamodel graph for visual validation.
131
132Returns
133-------
134graph : :class:`~openturns.GridLayout`
135    The visual validation graph."
136