queso-0.57.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-2017 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 #include <queso/ScopedPtr.h>
38 
39 namespace QUESO {
40 
41 class GslVector;
42 class GslMatrix;
43 
80 /* OLD STUFF: The constructor of the 'scalar function' asks for the user to specify which
81  * value the routine is actually computing, so that the 'scalar function' class can properly
82  * implements both class operations 'actualValue()' and 'minus2LnValue()'*/
83 
84 template <class P_V = GslVector, class P_M = GslMatrix>
86 {
87 public:
89 
90 
107  StatisticalInverseProblem(const char* prefix,
108  const SipOptionsValues* alternativeOptionsValues, // dakota
110  const BaseScalarFunction<P_V,P_M>& likelihoodFunction,
112 
114 
130  StatisticalInverseProblem(const char * prefix,
131  const SipOptionsValues * alternativeOptionsValues,
132  const GPMSAFactory<P_V,P_M> & gpmsaFactory,
133  GenericVectorRV<P_V,P_M> & postRv);
134 
138 
140 
141  bool computeSolutionFlag () const;
143 
145 
173  void solveWithBayesMetropolisHastings(const MhOptionsValues* alternativeOptionsValues, // dakota
174  const P_V& initialValues,
175  const P_M* initialProposalCovMatrix);
176 
178 
185  void solveWithBayesMetropolisHastings(const MhOptionsValues * alternativeOptionsValues,
186  const P_V & initialValues);
187 
189 
194  void solveWithBayesMetropolisHastings(const MhOptionsValues * alternativeOptionsValues);
195 
197 
203 
205 
209  void seedWithMAPEstimator();
210 
212  void solveWithBayesMLSampling ();
213 
216 
218  const BaseVectorRV <P_V,P_M>& priorRv () const;
219 
221 
222  const GenericVectorRV<P_V,P_M>& postRv () const;
223 
225 
226  const BaseVectorSequence<P_V,P_M>& chain() const;
227 
229 
231 
233 
235 
237  double logEvidence () const;
238 
240  double meanLogLikelihood () const;
241 
242  //\TODO Related to ML.
243  double eig () const;
245 
247 
248 
250  void print(std::ostream& os) const;
251  friend std::ostream& operator<<(std::ostream& os,
253  obj.print(os);
254  return os;
255  }
257 private:
259 
263 
269 
275 
277 
279 
280 #ifdef UQ_ALSO_COMPUTE_MDFS_WITHOUT_KDE
283 #endif
284 };
285 
286 } // End namespace QUESO
287 
288 #endif // UQ_SIP_H
void seedWithMAPEstimator()
Seeds the chain with the result of a deterministic optimisation.
ScopedPtr< ScalarSequence< double > >::Type m_logLikelihoodValues
ScopedPtr< ArrayOfOneDGrids< P_V, P_M > > m_subMdfGrids
const BaseVectorSequence< P_V, P_M > & chain() const
Returns the MCMC chain; access to private attribute m_chain.
double meanLogLikelihood() const
Returns the mean of the logarithm value of the likelihood. Related to ML.
friend std::ostream & operator<<(std::ostream &os, const StatisticalInverseProblem< P_V, P_M > &obj)
const ScalarSequence< double > & logTargetValues() const
Returns log target values; access to private attribute m_logTargetValues.
A templated class that represents a Metropolis-Hastings generator of samples.
const BaseScalarFunction< P_V, P_M > & m_likelihoodFunction
ScopedPtr< BaseVectorSequence< P_V, P_M > >::Type m_chain
std::unique_ptr< T > Type
Definition: ScopedPtr.h:76
double logEvidence() const
Returns the logarithm value of the evidence. Related to ML.
const ScalarSequence< double > & logLikelihoodValues() const
Returns log likelihood values; access to private attribute m_logLikelihoodValues. ...
ScopedPtr< ScalarSequence< double > >::Type m_logTargetValues
This class provides options for a Statistical Inverse Problem if no input file is available...
ScopedPtr< VectorSet< P_V, P_M > >::Type m_solutionDomain
ScopedPtr< ArrayOfOneDTables< P_V, P_M > > m_subMdfValues
ScopedPtr< const SipOptionsValues >::Type m_optionsObj
const BaseVectorRV< P_V, P_M > & priorRv() const
Returns the Prior RV; access to private attribute m_priorRv.
bool computeSolutionFlag() const
Whether or not compute the solution.
void print(std::ostream &os) const
TODO: Prints the sequence.
Base class for handling vector and array samples (sequence of vectors or arrays). ...
GenericVectorRV< P_V, P_M > & m_postRv
void solveWithBayesMetropolisHastings()
Solves the problem via Bayes formula and a Metropolis-Hastings algorithm.
This class provides options for the Metropolis-Hastings generator of samples if no input file is avai...
ScopedPtr< BaseJointPdf< P_V, P_M > >::Type m_solutionPdf
ScopedPtr< BaseVectorCdf< P_V, P_M > >::Type m_subSolutionCdf
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.
void solveWithBayesMLSampling()
Solves with Bayes Multi-Level (ML) sampling.
ScopedPtr< MetropolisHastingsSG< P_V, P_M > >::Type m_mhSeqGenerator
const BaseVectorRV< P_V, P_M > & m_priorRv
const MetropolisHastingsSG< P_V, P_M > & sequenceGenerator() const
Return the underlying MetropolisHastingSG object.
ScopedPtr< MLSampling< P_V, P_M > >::Type m_mlSampler
ScopedPtr< BaseVectorMdf< P_V, P_M > >::Type m_subSolutionMdf
ScopedPtr< BaseVectorRealizer< P_V, P_M > >::Type m_solutionRealizer
This templated class represents a Statistical Inverse Problem.
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
Definition: Environment.h:198

Generated on Sat Apr 22 2017 14:04:36 for queso-0.57.0 by  doxygen 1.8.5