File: gaussian_calibration.rst

package info (click to toggle)
openturns 1.24-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 66,204 kB
  • sloc: cpp: 256,662; python: 63,381; ansic: 4,414; javascript: 406; sh: 180; xml: 164; yacc: 123; makefile: 98; lex: 55
file content (303 lines) | stat: -rw-r--r-- 11,091 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
.. _gaussian_calibration:

Gaussian calibration
--------------------

Introduction
~~~~~~~~~~~~

In this page, we present the method used in the :class:`~openturns.GaussianLinearCalibration`
and :class:`~openturns.GaussianNonLinearCalibration` classes.
Gaussian calibration is a particular case of Bayesian calibration
(see :ref:`bayesian_calibration`) where
the prior has a Gaussian distribution and the observation error has a Gaussian
distribution.
In this case, simplifications occur which lead to an efficient
algorithm that requires fewer model evaluations compared to Monte-Carlo
Markov Chains (MCMC).

We consider a computer model :math:`\vect{h}` (i.e. a deterministic function)
to calibrate:

.. math::

    \vect{z} = \vect{h}(\vect{x}, \vect{\theta}),

where

-  :math:`\vect{x} \in \Rset^{d_x}` is the input vector;

-  :math:`\vect{z} \in \Rset^{d_z}` is the output vector;

-  :math:`\vect{\theta} \in \Rset^{d_h}` are the unknown parameters of
   :math:`\vect{h}` to calibrate.

Let :math:`n \in \Nset` be the number of observations.
The standard hypothesis of the probabilistic calibration is:

.. math::

    \vect{y}^i = \vect{z}^i + \vect{\varepsilon}^i,

for :math:`i=1,...,n` where :math:`\vect{\varepsilon}^i` is a random measurement error.

The goal of Gaussian calibration is to estimate :math:`\vect{\theta}`, based on
observations of :math:`n` inputs :math:`(\vect{x}^1, \ldots, \vect{x}^n)`
and the associated :math:`n` observations of the output
:math:`(\vect{y}^1, \ldots, \vect{y}^n)`.
In other words, the calibration process reduces the discrepancy between
the observations :math:`(\vect{y}^1, \ldots, \vect{y}^n)` and the
predictions :math:`\vect{h}(\vect{\theta})`.
Given that :math:`(\vect{y}^1, \ldots, \vect{y}^n)` are realizations of a
random variable, the estimate of :math:`\vect{\theta}`, denoted by
:math:`\hat{\vect{\theta}}`, is also a random variable.
Hence, the secondary goal of calibration is to estimate the distribution of
:math:`\hat{\vect{\theta}}` representing the uncertainty of the calibration
process.

In the remaining of this section, the input :math:`\vect{x}` is not involved
anymore in the equations.
This is why we simplify the equation into:

.. math::

    \vect{z} = \vect{h}(\vect{\theta}).

Bayesian calibration
~~~~~~~~~~~~~~~~~~~~

The Bayesian calibration framework is based on two hypotheses.
The first hypothesis is that the parameter :math:`\vect{\theta}` has
a known distribution, called the *prior* distribution, and denoted by :math:`p(\vect{\theta})`.
The second hypothesis is that the output observations :math:`(\vect{y}^1, \ldots, \vect{y}^n)`
are sampled from a known conditional distribution denoted by :math:`p(\vect{y} | \vect{\theta})`.
For any :math:`\vect{y}\in\Rset^{d_z}` such that :math:`p(\vect{y})>0`, the Bayes theorem implies
that the conditional distribution of :math:`\vect{\theta}` given :math:`\vect{y}` is:

.. math::

    p(\vect{\theta} | \vect{y}) = \frac{p(\vect{y} | \vect{\theta}) p(\vect{\theta})}{p(\vect{y})}

for any :math:`\vect{\theta}\in\Rset^{d_h}`.
The denominator of the previous Bayes fraction is independent of :math:`\vect{\theta}`, so that
the posterior distribution is proportional to the numerator:

.. math::

    p(\vect{\theta} | \vect{y}) \propto  p(\vect{y} | \vect{\theta}) p(\vect{\theta}).

for any :math:`\vect{\theta}\in\Rset^{d_h}`.

In Gaussian calibration, the two previous distributions are assumed to be gaussian.
More precisely, we make the hypothesis that the parameter :math:`\vect{\theta}`
follows the normal distribution:

.. math::

    \vect{\theta} \sim \mathcal{N}(\vect{\mu}, B),

where :math:`\vect{\mu}\in\Rset^{d_h}` is the mean of the gaussian prior distribution,
which is named the *background* and :math:`B\in\Rset^{d_h \times d_h}` is the covariance
matrix of the parameter.
Secondly, we make the hypothesis that the output observations follow the conditional normal distribution:

.. math::

    \vect{y} | \vect{\theta} \sim \mathcal{N}(\vect{h}(\vect{\theta}), \; R),

where :math:`R\in\Rset^{d_z \times d_z}` is the covariance
matrix of the output observations.

Posterior distribution
~~~~~~~~~~~~~~~~~~~~~~

Let :math:`\|\cdot\|_B` be the Mahalanobis distance associated with the matrix
:math:`B`:

.. math::

    \|\vect{\theta} - \vect{\mu} \|^2_B = (\vect{\theta} - \vect{\mu} )^T B^{-1} (\vect{\theta} - \vect{\mu} ),

for any :math:`\vect{\theta},\vect{\mu} \in \Rset^{d_h}`.
Denote by :math:`\|\cdot\|_R` the Mahalanobis distance associated with the matrix
:math:`R`:

.. math::

    \|\vect{y} - h(\vect{\theta})\|^2_R = (\vect{y} - h(\vect{\theta}))^T R^{-1} (\vect{y} - h(\vect{\theta})).

for any :math:`\vect{\theta} \in \Rset^{d_h}` and any :math:`\vect{y} \in \Rset^{d_z}`.
Therefore, the posterior distribution of :math:`\vect{\theta}` given the observations :math:`\vect{y}` is:

.. math::

    p(\vect{\theta}|\vect{y}) \propto \exp\left( -\frac{1}{2} \left( \|\vect{y}-H(\vect{\theta})\|^2_R
    + \|\vect{\theta}-\vect{\mu} \|^2_B \right) \right)

for any :math:`\vect{\theta}\in\Rset^{d_h}`.

MAP estimator
~~~~~~~~~~~~~

The maximum of the posterior distribution of :math:`\vect{\theta}` given the observations :math:`\vect{y}` is
reached at :

.. math::

    \hat{\vect{\theta}}_{MAP} = \argmin_{\vect{\theta}\in\Rset^{d_h}} \frac{1}{2} \left( \|\vect{y} - H(\vect{\theta})\|^2_R
    + \|\vect{\theta}-\vect{\mu} \|^2_B \right).

It is called the *maximum a posteriori posterior* estimator or
*MAP* estimator.

Regularity of solutions of the Gaussian Calibration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The gaussian calibration is a tradeoff, so that the
second expression acts as a *spring* which pulls the parameter
:math:`\vect{\theta}` closer to the background :math:`\vect{\mu}`
(depending on the "spring constant" :math:`B`)
meanwhile getting as close a possible to the observations.
Depending on the matrix :math:`B`, the computation may have
better regularity properties than the plain non linear least squares problem.

Non Linear Gaussian Calibration : 3DVAR
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The cost function of the gaussian nonlinear calibration problem is :

.. math::

    c(\vect{\theta}) = \frac{1}{2}\|\vect{y} - h(\vect{\theta})\|^2_R
    + \frac{1}{2}\|\vect{\theta}-\vect{\mu} \|^2_B

for any :math:`\vect{\theta}\in\Rset^{d_h}`.
The goal of non-linear Gaussian calibration is to find the
value of :math:`\vect{\theta}` which minimizes the cost function :math:`C`.
In general, this involves using a nonlinear unconstrained optimization solver.
Let :math:`J \in \Rset^{n \times d_h}` be the Jacobian matrix made of the
partial derivatives of :math:`\vect{h}` with respect to :math:`\vect{\theta}`:

.. math::

       J(\vect{\theta}) = \frac{\partial \vect{h}}{\partial \vect{\theta}}.

The Jacobian matrix of the cost function :math:`C` can be expressed
depending on the matrices :math:`R` and :math:`B` and the Jacobian matrix
of the function :math:`h`:

.. math::

    \frac{d }{d\vect{\theta}} c(\vect{\theta})
    = B^{-1} (\vect{\theta}-\vect{\mu}) + J(\vect{\theta})^T R^{-1} (H(\vect{\theta}) - \vect{y})

for any :math:`\vect{\theta}\in\Rset^{d_h}`.
The Hessian matrix of the cost function is:

.. math::

    \frac{d^2 }{d\vect{\theta}^2} c(\vect{\theta})
    = B^{-1}  + J(\vect{\theta})^T R^{-1} J(\vect{\theta})

for any :math:`\vect{\theta}\in\Rset^{d_h}`.

If the covariance matrix :math:`B` is positive definite,
then the Hessian matrix of the cost function is positive definite.
Under this hypothesis, the solution of the nonlinear Gaussian calibration is unique.

Solving the Non Linear Gaussian Calibration Problem
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The implementation of the resolution of the Gaussian non linear calibration
problem involves the Cholesky decomposition of the covariance matrices :math:`B`
and :math:`R`.
This allows one to transform the sum of two Mahalanobis distances into a single
Euclidean norm.
This leads to a classical non linear least squares problem.

Linear Gaussian Calibration
~~~~~~~~~~~~~~~~~~~~~~~~~~~

In Gaussian linear calibration, we assume that the parametric
function is linear with respect to the parameters.
This method is known as the Kalman filter in data assimilation.
We make the hypothesis that :math:`h` is linear with respect to :math:`\vect{\theta}`,
i.e., for any :math:`\vect{\theta}\in\Rset^{d_h}`, we have:

.. math::

    h(\vect{\theta}) = h(\vect{\mu}) + J(\vect{\theta}-\vect{\mu} ),

where :math:`J` is the constant Jacobian matrix of :math:`h`.

Let :math:`A` be the matrix:

.. math::

    A^{-1} = B^{-1} + J^T R^{-1} J.

We denote by :math:`K` the Kalman matrix:

.. math::

    K = A J^T R^{-1}.

The maximum of the posterior distribution of :math:`\vect{\theta}` given the
observations :math:`\vect{y}` is:

.. math::

    \hat{\vect{\theta}}_{MAP} = \vect{\mu} + K (\vect{y} - h(\vect{\mu})).

It can be proved that:

.. math::

    p(\vect{\theta} | \vect{y}) \propto
    \exp\left(\frac{1}{2} (\vect{\theta} - \hat{\vect{\theta}})^T A^{-1} (\vect{\theta} - \hat{\vect{\theta}}) \right)

for any :math:`\vect{\theta}\in\Rset^{d_h}`.
This implies:

.. math::

    \vect{\theta} \; | \; \vect{y} \sim \mathcal{N}\left(\hat{\vect{\theta}}_{MAP}, \; A\right)

Bias of Linear Gaussian Calibration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Assume that there is a true value of the parameter :math:`\vect{\theta}^\star`
that generated the output observations :math:`\vect{y}`.
Consider the MAP estimator :math:`\hat{\vect{\theta}}_{MAP}` as an
estimator of :math:`\vect{\theta}^\star`.
This estimator is a random variable which depends on the random sample of
output observations.
The MAP estimator is biased and the bias is:

.. math::

    \operatorname{Bias}\left(\hat{\vect{\theta}}_{MAP}\right)
    = (KJ - \operatorname{I})\left(\vect{\theta}^\star - \vect{\mu}\right).

This bias is introduced as a consequence of the regularization properties
of Gaussian calibration.
Due to the trade-off between bias and variance of the estimator of the
parameters, reducing the variance comes at the price of an increased bias.

.. topic:: API:

    - See :class:`~openturns.GaussianLinearCalibration`
    - See :class:`~openturns.GaussianNonLinearCalibration`

.. topic:: Examples:

    - See :doc:`/auto_calibration/least_squares_and_gaussian_calibration/plot_calibration_flooding`
    - See :doc:`/auto_calibration/least_squares_and_gaussian_calibration/plot_calibration_chaboche`
    - See :doc:`/auto_calibration/least_squares_and_gaussian_calibration/plot_calibration_deflection_tube`
    - See :doc:`/auto_calibration/least_squares_and_gaussian_calibration/plot_calibration_logistic`

.. topic:: References:

    - N. H. Bingham and John M. Fry (2010). *Regression, Linear Models in Statistics*, Springer Undergraduate Mathematics Series. Springer.
    - S. Huet, A. Bouvier, M.A. Poursat, and E. Jolivet (2004). *Statistical Tools for Nonlinear Regression*, Springer.
    - C. E. Rasmussen and C. K. I. Williams (2006), *Gaussian Processes for Machine Learning*, The MIT Press.