queso-0.53.0
StatisticalInverseProblem.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // QUESO - a library to support the Quantification of Uncertainty
5 // for Estimation, Simulation and Optimization
6 //
7 // Copyright (C) 2008-2015 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 #ifndef UQ_SIP_H
26 #define UQ_SIP_H
27 
28 #include <queso/StatisticalInverseProblemOptions.h>
29 #include <queso/MetropolisHastingsSG.h>
30 #include <queso/MLSampling.h>
31 #include <queso/InstantiateIntersection.h>
32 #include <queso/VectorRealizer.h>
33 #include <queso/SequentialVectorRealizer.h>
34 #include <queso/VectorRV.h>
35 #include <queso/ScalarFunction.h>
36 #include <queso/GPMSA.h>
37 
38 namespace QUESO {
39 
40 class GslVector;
41 class GslMatrix;
42 
79 /* OLD STUFF: The constructor of the 'scalar function' asks for the user to specify which
80  * value the routine is actually computing, so that the 'scalar function' class can properly
81  * implements both class operations 'actualValue()' and 'minus2LnValue()'*/
82 
83 template <class P_V = GslVector, class P_M = GslMatrix>
85 {
86 public:
88 
89 
96  StatisticalInverseProblem(const char* prefix,
97  const SipOptionsValues* alternativeOptionsValues, // dakota
99  const BaseScalarFunction<P_V,P_M>& likelihoodFunction,
101 
103 
115  StatisticalInverseProblem(const char * prefix,
116  const SipOptionsValues * alternativeOptionsValues,
117  const GPMSAFactory<P_V,P_M> & gpmsaFactory,
118  GenericVectorRV<P_V,P_M> & postRv);
119 
123 
125 
126  bool computeSolutionFlag () const;
128 
130 
158  void solveWithBayesMetropolisHastings(const MhOptionsValues* alternativeOptionsValues, // dakota
159  const P_V& initialValues,
160  const P_M* initialProposalCovMatrix);
161 
163 
167  void seedWithMAPEstimator();
168 
170  void solveWithBayesMLSampling ();
171 
174 
176  const BaseVectorRV <P_V,P_M>& priorRv () const;
177 
179 
180  const GenericVectorRV<P_V,P_M>& postRv () const;
181 
183 
184  const BaseVectorSequence<P_V,P_M>& chain() const;
185 
187 
189 
191 
193 
195  double logEvidence () const;
196 
198  double meanLogLikelihood () const;
199 
200  //\TODO Related to ML.
201  double eig () const;
203 
205 
206 
208  void print(std::ostream& os) const;
209  friend std::ostream& operator<<(std::ostream& os,
211  obj.print(os);
212  return os;
213  }
215 private:
217 
221 
227 
233 
235 
237 
238 #ifdef UQ_ALSO_COMPUTE_MDFS_WITHOUT_KDE
239  ArrayOfOneDGrids <P_V,P_M>* m_subMdfGrids;
240  ArrayOfOneDTables <P_V,P_M>* m_subMdfValues;
241 #endif
242 
244 };
245 
246 } // End namespace QUESO
247 
248 #endif // UQ_SIP_H
Class to accommodate arrays of one-dimensional grid.
const BaseScalarFunction< P_V, P_M > & m_likelihoodFunction
This class provides options for a Statistical Inverse Problem if no input file is available...
bool computeSolutionFlag() const
Whether or not compute the solution.
A templated class that represents a Metropolis-Hastings generator of samples.
void seedWithMAPEstimator()
Seeds the chain with the result of a deterministic optimisation.
StatisticalInverseProblem(const char *prefix, const SipOptionsValues *alternativeOptionsValues, const BaseVectorRV< P_V, P_M > &priorRv, const BaseScalarFunction< P_V, P_M > &likelihoodFunction, GenericVectorRV< P_V, P_M > &postRv)
Constructor.
const GenericVectorRV< P_V, P_M > & postRv() const
Returns the Posterior RV; access to private attribute m_postrRv.
const BaseVectorRV< P_V, P_M > & m_priorRv
const MetropolisHastingsSG< P_V, P_M > & sequenceGenerator() const
Return the underlying MetropolisHastingSG object.
double logEvidence() const
Returns the logarithm value of the evidence. Related to ML.
ScalarSequence< double > * m_logTargetValues
BaseJointPdf< P_V, P_M > * m_solutionPdf
BaseVectorSequence< P_V, P_M > * m_chain
void solveWithBayesMetropolisHastings(const MhOptionsValues *alternativeOptionsValues, const P_V &initialValues, const P_M *initialProposalCovMatrix)
Solves the problem via Bayes formula and a Metropolis-Hastings algorithm.
BaseVectorMdf< P_V, P_M > * m_subSolutionMdf
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
Definition: Environment.h:193
void solveWithBayesMLSampling()
Solves with Bayes Multi-Level (ML) sampling.
const BaseVectorSequence< P_V, P_M > & chain() const
Returns the MCMC chain; access to private attribute m_chain.
This class provides options for the Metropolis-Hastings generator of samples if no input file is avai...
Class to accommodate arrays of one-dimensional tables.
MetropolisHastingsSG< P_V, P_M > * m_mhSeqGenerator
const ScalarSequence< double > & logTargetValues() const
Returns log target values; access to private attribute m_logTargetValues.
A templated class that represents a Multilevel generator of samples.
Definition: MLSampling.h:122
friend std::ostream & operator<<(std::ostream &os, const StatisticalInverseProblem< P_V, P_M > &obj)
void print(std::ostream &os) const
TODO: Prints the sequence.
BaseVectorCdf< P_V, P_M > * m_subSolutionCdf
ScalarSequence< double > * m_logLikelihoodValues
double meanLogLikelihood() const
Returns the mean of the logarithm value of the likelihood. Related to ML.
GenericVectorRV< P_V, P_M > & m_postRv
const ScalarSequence< double > & logLikelihoodValues() const
Returns log likelihood values; access to private attribute m_logLikelihoodValues. ...
BaseVectorRealizer< P_V, P_M > * m_solutionRealizer
const BaseVectorRV< P_V, P_M > & priorRv() const
Returns the Prior RV; access to private attribute m_priorRv.
This templated class represents a Statistical Inverse Problem.

Generated on Thu Jun 11 2015 13:52:32 for queso-0.53.0 by  doxygen 1.8.5