Salome HOME
Minor documentation and source correction for outputs
[modules/adao.git] / doc / en / ref_algorithm_SamplingTest.rst
1 ..
2    Copyright (C) 2008-2015 EDF R&D
3
4    This file is part of SALOME ADAO module.
5
6    This library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
10
11    This library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15
16    You should have received a copy of the GNU Lesser General Public
17    License along with this library; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19
20    See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21
22    Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
23
24 .. index:: single: SamplingTest
25 .. _section_ref_algorithm_SamplingTest:
26
27 Checking algorithm "*SamplingTest*"
28 -----------------------------------
29
30 Description
31 +++++++++++
32
33 This algorithm allows to calculate the values, linked to a :math:`\mathbf{x}`
34 state, of a general error function :math:`J` of type :math:`L^1`, :math:`L^2` or
35 :math:`L^{\infty}`, with or without weights, and of the observation operator,
36 for an priori given states sample. The default error function is the augmented
37 weighted least squares function, classicaly used in data assimilation.
38
39 It is useful to test the sensitivity, of the error function :math:`J`, in
40 particular, to the state :math:`\mathbf{x}` variations. When a state is not
41 observable, a *"NaN"* value is returned.
42
43 The sampling of the states :math:`\mathbf{x}` can be given explicitly or under
44 the form of hyper-cubes, explicit or sampled using classic distributions. Be
45 careful to the size of the hyper-cube (and then to the number of calculations)
46 that can be reached, it can be big very quickly.
47
48 To perform distributed or complex sampling, see other modules available in
49 SALOME : PARAMETRIC or OPENTURNS.
50
51 Optional and required commands
52 ++++++++++++++++++++++++++++++
53
54 .. index:: single: CheckingPoint
55 .. index:: single: BackgroundError
56 .. index:: single: Observation
57 .. index:: single: ObservationError
58 .. index:: single: ObservationOperator
59 .. index:: single: SampleAsnUplet
60 .. index:: single: SampleAsExplicitHyperCube
61 .. index:: single: SampleAsMinMaxStepHyperCube
62 .. index:: single: SampleAsIndependantRandomVariables
63 .. index:: single: QualityCriterion
64 .. index:: single: SetDebug
65 .. index:: single: SetSeed
66 .. index:: single: StoreSupplementaryCalculations
67
68 The general required commands, available in the editing user interface, are the
69 following:
70
71   CheckingPoint
72     *Required command*. This indicates the vector used as the state around which
73     to perform the required check, noted :math:`\mathbf{x}` and similar to the
74     background :math:`\mathbf{x}^b`. It is defined as a "*Vector*" type object.
75
76   BackgroundError
77     *Required command*. This indicates the background error covariance matrix,
78     previously noted as :math:`\mathbf{B}`. Its value is defined as a "*Matrix*"
79     type object, a "*ScalarSparseMatrix*" type object, or a
80     "*DiagonalSparseMatrix*" type object.
81
82   Observation
83     *Required command*. This indicates the observation vector used for data
84     assimilation or optimization, previously noted as :math:`\mathbf{y}^o`. It
85     is defined as a "*Vector*" or a *VectorSerie* type object.
86
87   ObservationError
88     *Required command*. This indicates the observation error covariance matrix,
89     previously noted as :math:`\mathbf{R}`. It is defined as a "*Matrix*" type
90     object, a "*ScalarSparseMatrix*" type object, or a "*DiagonalSparseMatrix*"
91     type object.
92
93   ObservationOperator
94     *Required command*. This indicates the observation operator, previously
95     noted :math:`H`, which transforms the input parameters :math:`\mathbf{x}` to
96     results :math:`\mathbf{y}` to be compared to observations
97     :math:`\mathbf{y}^o`. Its value is defined as a "*Function*" type object or
98     a "*Matrix*" type one. In the case of "*Function*" type, different
99     functional forms can be used, as described in the section
100     :ref:`section_ref_operator_requirements`. If there is some control :math:`U`
101     included in the observation, the operator has to be applied to a pair
102     :math:`(X,U)`.
103
104 The general optional commands, available in the editing user interface, are
105 indicated in :ref:`section_ref_assimilation_keywords`. In particular, the
106 optional command "*AlgorithmParameters*" allows to choose the specific options,
107 described hereafter, of the algorithm. See
108 :ref:`section_ref_options_AlgorithmParameters` for the good use of this command.
109
110 The options of the algorithm are the following:
111
112   SampleAsnUplet
113     This key describes the calculations points as a list of n-uplets, each
114     n-uplet being a state.
115
116     Example : ``{"SampleAsnUplet":[[0,1,2,3],[4,3,2,1],[-2,3,-4,5]]}`` for 3 points in a state space of dimension 4
117
118   SampleAsExplicitHyperCube
119     This key describes the calculations points as an hyper-cube, from a given
120     list of explicit sampling of each variable as a list. That is then a list of
121     lists, each of them being potentially of different size.
122
123     Example : ``{"SampleAsExplicitHyperCube":[[0.,0.25,0.5,0.75,1.],[-2,2,1]]}`` for a state space of dimension 2
124
125   SampleAsMinMaxStepHyperCube
126     This key describes the calculations points as an hyper-cube, from a given
127     list of implicit sampling of each variable by a triplet *[min,max,step]*.
128     That is then a list of the same size than the one of the state. The bounds
129     are included.
130
131     Example : ``{"SampleAsMinMaxStepHyperCube":[[0.,1.,0.25],[-1,3,1]]}`` for a state space of dimension 2
132
133   SampleAsIndependantRandomVariables
134     This key describes the calculations points as an hyper-cube, for which the
135     points on each axis come from a independant random sampling of the axis
136     variable, under the specification of the distribution, its parameters and
137     the number of points in the sample, as a list ``['distribution',
138     [parametres], nombre]`` for each axis. The possible distributions are
139     'normal' of parameters (mean,std), 'lognormal' of parameters (mean,sigma),
140     'uniform' of parameters (low,high), or 'weibull' of parameter (shape). That
141     is then a list of the same size than the one of the state.
142
143     Example : ``{"SampleAsIndependantRandomVariables":[['normal',[0.,1.],3],['uniform',[-2,2],4]]`` for a state space of dimension 2
144
145   QualityCriterion
146     This key indicates the quality criterion, used to find the state estimate.
147     The default is the usual data assimilation criterion named "DA", the
148     augmented weighted least squares. The possible criteria has to be in the
149     following list, where the equivalent names are indicated by the sign "=":
150     ["AugmentedWeightedLeastSquares"="AWLS"="DA", "WeightedLeastSquares"="WLS",
151     "LeastSquares"="LS"="L2", "AbsoluteValue"="L1", "MaximumError"="ME"].
152
153     Example : ``{"QualityCriterion":"DA"}``
154
155   SetDebug
156     This key requires the activation, or not, of the debug mode during the
157     function evaluation. The default is "True", the choices are "True" or
158     "False".
159
160     Example : ``{"SetDebug":False}``
161
162   SetSeed
163     This key allow to give an integer in order to fix the seed of the random
164     generator used to generate the ensemble. A convenient value is for example
165     1000. By default, the seed is left uninitialized, and so use the default
166     initialization from the computer.
167
168     Example : ``{"SetSeed":1000}``
169
170   StoreSupplementaryCalculations
171     This list indicates the names of the supplementary variables that can be
172     available at the end of the algorithm. It involves potentially costly
173     calculations or memory consumptions. The default is a void list, none of
174     these variables being calculated and stored by default. The possible names
175     are in the following list: ["CostFunctionJ", "CurrentState", "Innovation",
176     "SimulatedObservationAtCurrentState"].
177
178     Example : ``{"StoreSupplementaryCalculations":["CostFunctionJ", "SimulatedObservationAtCurrentState"]}``
179
180 See also
181 ++++++++
182
183 References to other sections:
184   - :ref:`section_ref_algorithm_FunctionTest`
185
186 References to other SALOME modules:
187   - PARAMETRIC, see the *User guide of PARAMETRIC module* in the main "*Help*" menu of SALOME platform
188   - OPENTURNS, see the *User guide of OPENTURNS module* in the main "*Help*" menu of SALOME platform