queso-0.57.0
MLSampling.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_MULTI_LEVEL_SAMPLING_H
26 #define UQ_MULTI_LEVEL_SAMPLING_H
27 
28 #define ML_NEW_CODE_2009_12_29
29 
30 #include <queso/MLSamplingOptions.h>
31 #include <queso/MetropolisHastingsSG.h>
32 #include <queso/FiniteDistribution.h>
33 #include <queso/VectorRV.h>
34 #include <queso/GenericVectorRV.h>
35 #include <queso/VectorSpace.h>
36 #include <queso/MarkovChainPositionData.h>
37 #include <queso/ScalarFunctionSynchronizer.h>
38 #include <queso/SequenceOfVectors.h>
39 #include <queso/ArrayOfSequences.h>
40 #ifdef QUESO_HAS_GLPK
41 #include <glpk.h>
42 #endif
43 #include <sys/time.h>
44 #include <fstream>
45 
46 #define ML_CHECKPOINT_FIXED_AMOUNT_OF_DATA 6
47 
48 //---------------------------------------------------------
49 
50 namespace QUESO {
51 
52 class GslVector;
53 class GslMatrix;
54 
55 #ifdef QUESO_HAS_GLPK
58  unsigned int currLevel;
59 };
60 
61 void BIP_routine(glp_tree *tree, void *info);
62 #endif
63 
64 //---------------------------------------------------------
65 
67 {
71  unsigned int numberOfPositions;
72 };
73 
74 //---------------------------------------------------------
75 
76 template <class P_V = GslVector>
78 {
82  unsigned int numberOfPositions;
83 };
84 
85 template <class P_V = GslVector>
87 {
88  std::vector<BalancedLinkedChainControlStruct<P_V> > balLinkedChains;
89 };
90 
91 //---------------------------------------------------------
92 
94 {
95  unsigned int initialPositionIndexInPreviousChain; // KEY new: add logPrior and logLikelihood
96  unsigned int numberOfPositions;
97 };
98 
100 {
101  std::vector<UnbalancedLinkedChainControlStruct> unbLinkedChains;
102 };
103 
104 //---------------------------------------------------------
105 
106 //---------------------------------------------------------
116  /* If options request data to be written in the output file (MATLAB .m format
117  * only, for now), the user can check which MATLAB variables are defined and set by running
118  * 'grep zeros <OUTPUT FILE NAME>' after the solution procedures ends.
119  * The names of the variables are chosen to be self explanatory. */
120 
121 template <class P_V = GslVector, class P_M = GslMatrix>
123 {
124 public:
126 
127 
132  MLSampling( const char* prefix, const BaseVectorRV <P_V,P_M>& priorRv, const BaseScalarFunction<P_V,P_M>& likelihoodFunction);
136  ~MLSampling();
138 
140 
165  void generateSequence (BaseVectorSequence<P_V,P_M>& workingChain,
166  ScalarSequence<double>* workingLogLikelihoodValues,
167  ScalarSequence<double>* workingLogTargetValues);
168 
170 
171  double logEvidence () const;
172 
174 
175  double meanLogLikelihood() const;
176 
178 
195  double eig () const;
197 
199 
200 
202  void print (std::ostream& os) const;
204 
205 
206  friend std::ostream& operator<<(std::ostream& os,
207  const MLSampling<P_V,P_M>& obj) {
208  obj.print(os);
209  return os;
210  }
211 
212 private:
214 
216  void checkpointML (double currExponent, // input
217  double currEta, // input
218  const SequenceOfVectors<P_V,P_M>& currChain, // input
219  const ScalarSequence<double>& currLogLikelihoodValues, // input
220  const ScalarSequence<double>& currLogTargetValues); // input
221 
223 
226  void restartML (double& currExponent, // output
227  double& currEta, // output
228  SequenceOfVectors<P_V,P_M>& currChain, // output
229  ScalarSequence<double>& currLogLikelihoodValues, // output
230  ScalarSequence<double>& currLogTargetValues); // output
231 
233 
235  void generateSequence_Level0_all (const MLSamplingLevelOptions& currOptions, // input
236  unsigned int& unifiedRequestedNumSamples, // output
237  SequenceOfVectors<P_V,P_M>& currChain, // output
238  ScalarSequence<double>& currLogLikelihoodValues, // output
239  ScalarSequence<double>& currLogTargetValues); // output
240 
242 
245  void generateSequence_Step01_inter0(const MLSamplingLevelOptions* currOptions, // input
246  unsigned int& unifiedRequestedNumSamples); // output
247 
249 
253  void generateSequence_Step02_inter0(const MLSamplingLevelOptions* currOptions, // input
254  SequenceOfVectors<P_V,P_M>& currChain, // input/output
255  ScalarSequence<double>& currLogLikelihoodValues, // input/output
256  ScalarSequence<double>& currLogTargetValues, // input/output
257  SequenceOfVectors<P_V,P_M>& prevChain, // output
258  ScalarSequence<double>& prevLogLikelihoodValues, // output
259  ScalarSequence<double>& prevLogTargetValues, // output
260  unsigned int& indexOfFirstWeight, // output
261  unsigned int& indexOfLastWeight); // output
262 
264 
267  void generateSequence_Step03_inter0(const MLSamplingLevelOptions* currOptions, // input
268  const ScalarSequence<double>& prevLogLikelihoodValues, // input
269  double prevExponent, // input
270  double failedExponent, // input // gpmsa1
271  double& currExponent, // output
272  ScalarSequence<double>& weightSequence); // output
273 
275 
278  void generateSequence_Step04_inter0(const SequenceOfVectors<P_V,P_M>& prevChain, // input
279  const ScalarSequence<double>& weightSequence, // input
280  P_M& unifiedCovMatrix); // output
281 
283 
286  void generateSequence_Step05_inter0(unsigned int unifiedRequestedNumSamples, // input
287  const ScalarSequence<double>& weightSequence, // input
288  std::vector<unsigned int>& unifiedIndexCountersAtProc0Only, // output
289  std::vector<double>& unifiedWeightStdVectorAtProc0Only); // output
290 
292 
295  void generateSequence_Step06_all (const MLSamplingLevelOptions* currOptions, // input
296  unsigned int indexOfFirstWeight, // input
297  unsigned int indexOfLastWeight, // input
298  const std::vector<unsigned int>& unifiedIndexCountersAtProc0Only, // input
299  bool& useBalancedChains, // output
300  std::vector<ExchangeInfoStruct>& exchangeStdVec); // output
301 
303 
307  void generateSequence_Step07_inter0(bool useBalancedChains, // input
308  unsigned int indexOfFirstWeight, // input
309  unsigned int indexOfLastWeight, // input
310  const std::vector<unsigned int>& unifiedIndexCountersAtProc0Only, // input
311  UnbalancedLinkedChainsPerNodeStruct& unbalancedLinkControl, // (possible) output
312  const MLSamplingLevelOptions* currOptions, // input
313  const SequenceOfVectors<P_V,P_M>& prevChain, // input
314  double prevExponent, // input
315  double currExponent, // input
316  const ScalarSequence<double>& prevLogLikelihoodValues, // input
317  const ScalarSequence<double>& prevLogTargetValues, // input
318  std::vector<ExchangeInfoStruct>& exchangeStdVec, // (possible) input/output
319  BalancedLinkedChainsPerNodeStruct<P_V>& balancedLinkControl); // (possible) output
320 
322 
325  void generateSequence_Step08_all (BayesianJointPdf<P_V,P_M>& currPdf, // input/output
326  GenericVectorRV<P_V,P_M>& currRv); // output
327 
329 
333  void generateSequence_Step09_all (const SequenceOfVectors<P_V,P_M>& prevChain, // input
334  double prevExponent, // input
335  double currExponent, // input
336  const ScalarSequence<double>& prevLogLikelihoodValues, // input
337  const ScalarSequence<double>& prevLogTargetValues, // input
338  unsigned int indexOfFirstWeight, // input
339  unsigned int indexOfLastWeight, // input
340  const std::vector<double>& unifiedWeightStdVectorAtProc0Only, // input
341  const ScalarSequence<double>& weightSequence, // input
342  double prevEta, // input
343  const GenericVectorRV<P_V,P_M>& currRv, // input
344  MLSamplingLevelOptions* currOptions, // input (changed temporarily internally)
345  P_M& unifiedCovMatrix, // input/output
346  double& currEta); // output
347 
349 
352  void generateSequence_Step10_all (MLSamplingLevelOptions& currOptions, // input (changed temporarily internally)
353  const P_M& unifiedCovMatrix, // input
354  const GenericVectorRV <P_V,P_M>& currRv, // input
355  bool useBalancedChains, // input
356  const UnbalancedLinkedChainsPerNodeStruct& unbalancedLinkControl, // input // Round Rock
357  unsigned int indexOfFirstWeight, // input // Round Rock
358  const SequenceOfVectors<P_V,P_M>& prevChain, // input // Round Rock
359  double prevExponent, // input
360  double currExponent, // input
361  const ScalarSequence<double>& prevLogLikelihoodValues, // input
362  const ScalarSequence<double>& prevLogTargetValues, // input
363  const BalancedLinkedChainsPerNodeStruct<P_V>& balancedLinkControl, // input // Round Rock
364  SequenceOfVectors <P_V,P_M>& currChain, // output
365  double& cumulativeRawChainRunTime, // output
366  unsigned int& cumulativeRawChainRejections, // output
367  ScalarSequence <double>* currLogLikelihoodValues, // output
368  ScalarSequence <double>* currLogTargetValues); // output
369 
371 
375  void generateSequence_Step11_inter0(const MLSamplingLevelOptions* currOptions, // input
376  unsigned int unifiedRequestedNumSamples, // input
377  unsigned int cumulativeRawChainRejections, // input
378  SequenceOfVectors<P_V,P_M>& currChain, // input/output
379  ScalarSequence<double>& currLogLikelihoodValues, // input/output
380  ScalarSequence<double>& currLogTargetValues, // input/output
381  unsigned int& unifiedNumberOfRejections); // output
382 
385  void sampleIndexes_proc0 (unsigned int unifiedRequestedNumSamples, // input
386  const std::vector<double>& unifiedWeightStdVectorAtProc0Only, // input
387  std::vector<unsigned int>& unifiedIndexCountersAtProc0Only); // output
388 
391  bool decideOnBalancedChains_all (const MLSamplingLevelOptions* currOptions, // input
392  unsigned int indexOfFirstWeight, // input
393  unsigned int indexOfLastWeight, // input
394  const std::vector<unsigned int>& unifiedIndexCountersAtProc0Only, // input
395  std::vector<ExchangeInfoStruct>& exchangeStdVec); // output
396 
399  void prepareBalLinkedChains_inter0 (const MLSamplingLevelOptions* currOptions, // input
400  const SequenceOfVectors<P_V,P_M>& prevChain, // input
401  double prevExponent, // input
402  double currExponent, // input
403  const ScalarSequence<double>& prevLogLikelihoodValues, // input
404  const ScalarSequence<double>& prevLogTargetValues, // input
405  std::vector<ExchangeInfoStruct>& exchangeStdVec, // input/output
406  BalancedLinkedChainsPerNodeStruct<P_V>& balancedLinkControl); // output
407 
410  void prepareUnbLinkedChains_inter0 (unsigned int indexOfFirstWeight, // input
411  unsigned int indexOfLastWeight, // input
412  const std::vector<unsigned int>& unifiedIndexCountersAtProc0Only, // input
413  UnbalancedLinkedChainsPerNodeStruct& unbalancedLinkControl); // output
414 
417  void generateBalLinkedChains_all (MLSamplingLevelOptions& inputOptions, // input, only m_rawChainSize changes
418  const P_M& unifiedCovMatrix, // input
419  const GenericVectorRV <P_V,P_M>& rv, // input
420  const BalancedLinkedChainsPerNodeStruct<P_V>& balancedLinkControl, // input // Round Rock
421  SequenceOfVectors <P_V,P_M>& workingChain, // output
422  double& cumulativeRunTime, // output
423  unsigned int& cumulativeRejections, // output
424  ScalarSequence <double>* currLogLikelihoodValues, // output
425  ScalarSequence <double>* currLogTargetValues); // output
426 
429  void generateUnbLinkedChains_all (MLSamplingLevelOptions& inputOptions, // input, only m_rawChainSize changes
430  const P_M& unifiedCovMatrix, // input
431  const GenericVectorRV <P_V,P_M>& rv, // input
432  const UnbalancedLinkedChainsPerNodeStruct& unbalancedLinkControl, // input // Round Rock
433  unsigned int indexOfFirstWeight, // input // Round Rock
434  const SequenceOfVectors<P_V,P_M>& prevChain, // input // Round Rock
435  double prevExponent, // input
436  double currExponent, // input
437  const ScalarSequence<double>& prevLogLikelihoodValues, // input
438  const ScalarSequence<double>& prevLogTargetValues, // input
439  SequenceOfVectors <P_V,P_M>& workingChain, // output
440  double& cumulativeRunTime, // output
441  unsigned int& cumulativeRejections, // output
442  ScalarSequence <double>* currLogLikelihoodValues, // output
443  ScalarSequence <double>* currLogTargetValues); // output
444 
445 #ifdef QUESO_HAS_GLPK
446 
448  void solveBIP_proc0 (std::vector<ExchangeInfoStruct>& exchangeStdVec); // input/output
449 #endif
450 
453  void justBalance_proc0 (const MLSamplingLevelOptions* currOptions, // input
454  std::vector<ExchangeInfoStruct>& exchangeStdVec); // input/output
455 
458  void mpiExchangePositions_inter0 (const SequenceOfVectors<P_V,P_M>& prevChain, // input
459  double prevExponent, // input
460  double currExponent, // input
461  const ScalarSequence<double>& prevLogLikelihoodValues, // input
462  const ScalarSequence<double>& prevLogTargetValues, // input
463  const std::vector<ExchangeInfoStruct>& exchangeStdVec, // input
464  const std::vector<unsigned int>& finalNumChainsPerNode, // input
465  const std::vector<unsigned int>& finalNumPositionsPerNode, // input
466  BalancedLinkedChainsPerNodeStruct<P_V>& balancedLinkControl); // output
467 
468  // Private variables
471 
474 
477 
480 
483 
484  unsigned int m_numDisabledParameters; // gpmsa2
485 
486  std::vector<bool> m_parameterEnabledStatus; // gpmsa2
487 
490 
492  unsigned int m_currLevel; // restart
493 
495  unsigned int m_currStep;
496 
499  std::vector<double> m_logEvidenceFactors; // restart
502  double m_eig;
503 };
504 
505 } // End namespace QUESO
506 
507 #endif // UQ_MULTI_LEVEL_SAMPLING_H
std::vector< BalancedLinkedChainControlStruct< P_V > > balLinkedChains
Definition: MLSampling.h:88
void justBalance_proc0(const MLSamplingLevelOptions *currOptions, std::vector< ExchangeInfoStruct > &exchangeStdVec)
Definition: MLSampling.C:1500
void generateSequence_Step09_all(const SequenceOfVectors< P_V, P_M > &prevChain, double prevExponent, double currExponent, const ScalarSequence< double > &prevLogLikelihoodValues, const ScalarSequence< double > &prevLogTargetValues, unsigned int indexOfFirstWeight, unsigned int indexOfLastWeight, const std::vector< double > &unifiedWeightStdVectorAtProc0Only, const ScalarSequence< double > &weightSequence, double prevEta, const GenericVectorRV< P_V, P_M > &currRv, MLSamplingLevelOptions *currOptions, P_M &unifiedCovMatrix, double &currEta)
Scales the unified covariance matrix until min &lt;= rejection rate &lt;= max (Step 09 from ML algorithm)...
Definition: MLSampling.C:3235
void generateBalLinkedChains_all(MLSamplingLevelOptions &inputOptions, const P_M &unifiedCovMatrix, const GenericVectorRV< P_V, P_M > &rv, const BalancedLinkedChainsPerNodeStruct< P_V > &balancedLinkControl, SequenceOfVectors< P_V, P_M > &workingChain, double &cumulativeRunTime, unsigned int &cumulativeRejections, ScalarSequence< double > *currLogLikelihoodValues, ScalarSequence< double > *currLogTargetValues)
Definition: MLSampling.C:633
void generateUnbLinkedChains_all(MLSamplingLevelOptions &inputOptions, const P_M &unifiedCovMatrix, const GenericVectorRV< P_V, P_M > &rv, const UnbalancedLinkedChainsPerNodeStruct &unbalancedLinkControl, unsigned int indexOfFirstWeight, const SequenceOfVectors< P_V, P_M > &prevChain, double prevExponent, double currExponent, const ScalarSequence< double > &prevLogLikelihoodValues, const ScalarSequence< double > &prevLogTargetValues, SequenceOfVectors< P_V, P_M > &workingChain, double &cumulativeRunTime, unsigned int &cumulativeRejections, ScalarSequence< double > *currLogLikelihoodValues, ScalarSequence< double > *currLogTargetValues)
Definition: MLSampling.C:891
std::vector< UnbalancedLinkedChainControlStruct > unbLinkedChains
Definition: MLSampling.h:101
void generateSequence_Step07_inter0(bool useBalancedChains, unsigned int indexOfFirstWeight, unsigned int indexOfLastWeight, const std::vector< unsigned int > &unifiedIndexCountersAtProc0Only, UnbalancedLinkedChainsPerNodeStruct &unbalancedLinkControl, const MLSamplingLevelOptions *currOptions, const SequenceOfVectors< P_V, P_M > &prevChain, double prevExponent, double currExponent, const ScalarSequence< double > &prevLogLikelihoodValues, const ScalarSequence< double > &prevLogTargetValues, std::vector< ExchangeInfoStruct > &exchangeStdVec, BalancedLinkedChainsPerNodeStruct< P_V > &balancedLinkControl)
Plans for number of linked chains for each node so that all nodes generate the closest possible to th...
Definition: MLSampling.C:3134
void generateSequence_Step03_inter0(const MLSamplingLevelOptions *currOptions, const ScalarSequence< double > &prevLogLikelihoodValues, double prevExponent, double failedExponent, double &currExponent, ScalarSequence< double > &weightSequence)
Computes currExponent and sequence of weights for current level and update &#39;m_logEvidenceFactors&#39; (St...
Definition: MLSampling.C:2623
double m_debugExponent
Exponent for debugging.
Definition: MLSampling.h:498
void generateSequence_Step04_inter0(const SequenceOfVectors< P_V, P_M > &prevChain, const ScalarSequence< double > &weightSequence, P_M &unifiedCovMatrix)
Creates covariance matrix for current level (Step 04 from ML algorithm).
Definition: MLSampling.C:2927
const BaseScalarFunction< P_V, P_M > & m_likelihoodFunction
Likelihood function.
Definition: MLSampling.h:476
double m_meanLogLikelihood
Definition: MLSampling.h:501
void generateSequence_Step01_inter0(const MLSamplingLevelOptions *currOptions, unsigned int &unifiedRequestedNumSamples)
Reads options for the ML algorithm (Step 01 from ML algorithm).
Definition: MLSampling.C:2445
void generateSequence_Step11_inter0(const MLSamplingLevelOptions *currOptions, unsigned int unifiedRequestedNumSamples, unsigned int cumulativeRawChainRejections, SequenceOfVectors< P_V, P_M > &currChain, ScalarSequence< double > &currLogLikelihoodValues, ScalarSequence< double > &currLogTargetValues, unsigned int &unifiedNumberOfRejections)
Filters chain (Step 11 from ML algorithm).
Definition: MLSampling.C:3819
double m_logEvidence
Definition: MLSampling.h:500
const VectorSpace< P_V, P_M > & m_vectorSpace
Vector space.
Definition: MLSampling.h:479
unsigned int originalIndexOfInitialPosition
Definition: MLSampling.h:69
unsigned int currLevel
Definition: MLSampling.h:58
void prepareUnbLinkedChains_inter0(unsigned int indexOfFirstWeight, unsigned int indexOfLastWeight, const std::vector< unsigned int > &unifiedIndexCountersAtProc0Only, UnbalancedLinkedChainsPerNodeStruct &unbalancedLinkControl)
Definition: MLSampling.C:470
unsigned int m_numDisabledParameters
Definition: MLSampling.h:484
unsigned int m_currStep
Curret step.
Definition: MLSampling.h:495
void sampleIndexes_proc0(unsigned int unifiedRequestedNumSamples, const std::vector< double > &unifiedWeightStdVectorAtProc0Only, std::vector< unsigned int > &unifiedIndexCountersAtProc0Only)
Definition: MLSampling.C:95
void generateSequence_Step06_all(const MLSamplingLevelOptions *currOptions, unsigned int indexOfFirstWeight, unsigned int indexOfLastWeight, const std::vector< unsigned int > &unifiedIndexCountersAtProc0Only, bool &useBalancedChains, std::vector< ExchangeInfoStruct > &exchangeStdVec)
Decides on wheter or not to use balanced chains (Step 06 from ML algorithm).
Definition: MLSampling.C:3101
friend std::ostream & operator<<(std::ostream &os, const MLSampling< P_V, P_M > &obj)
Definition: MLSampling.h:206
void restartML(double &currExponent, double &currEta, SequenceOfVectors< P_V, P_M > &currChain, ScalarSequence< double > &currLogLikelihoodValues, ScalarSequence< double > &currLogTargetValues)
Restarts ML algorithm.
Definition: MLSampling.C:2118
void generateSequence_Step05_inter0(unsigned int unifiedRequestedNumSamples, const ScalarSequence< double > &weightSequence, std::vector< unsigned int > &unifiedIndexCountersAtProc0Only, std::vector< double > &unifiedWeightStdVectorAtProc0Only)
Creates unified finite distribution for current level (Step 05 from ML algorithm).
Definition: MLSampling.C:3021
std::vector< double > m_logEvidenceFactors
Definition: MLSampling.h:499
void generateSequence_Step08_all(BayesianJointPdf< P_V, P_M > &currPdf, GenericVectorRV< P_V, P_M > &currRv)
Creates a vector RV for current level (Step 08 from ML algorithm).
Definition: MLSampling.C:3202
std::vector< bool > m_parameterEnabledStatus
Definition: MLSampling.h:486
void mpiExchangePositions_inter0(const SequenceOfVectors< P_V, P_M > &prevChain, double prevExponent, double currExponent, const ScalarSequence< double > &prevLogLikelihoodValues, const ScalarSequence< double > &prevLogTargetValues, const std::vector< ExchangeInfoStruct > &exchangeStdVec, const std::vector< unsigned int > &finalNumChainsPerNode, const std::vector< unsigned int > &finalNumPositionsPerNode, BalancedLinkedChainsPerNodeStruct< P_V > &balancedLinkControl)
Definition: MLSampling.C:1788
const BaseEnvironment * env
Definition: MLSampling.h:57
double meanLogLikelihood() const
Method to calculate the mean of the logarithm of the likelihood.
Definition: MLSampling.C:4836
void generateSequence_Step02_inter0(const MLSamplingLevelOptions *currOptions, SequenceOfVectors< P_V, P_M > &currChain, ScalarSequence< double > &currLogLikelihoodValues, ScalarSequence< double > &currLogTargetValues, SequenceOfVectors< P_V, P_M > &prevChain, ScalarSequence< double > &prevLogLikelihoodValues, ScalarSequence< double > &prevLogTargetValues, unsigned int &indexOfFirstWeight, unsigned int &indexOfLastWeight)
Saves chain and corresponding target pdf values from previous level (Step 02 from ML algorithm)...
Definition: MLSampling.C:2491
void generateSequence_Level0_all(const MLSamplingLevelOptions &currOptions, unsigned int &unifiedRequestedNumSamples, SequenceOfVectors< P_V, P_M > &currChain, ScalarSequence< double > &currLogLikelihoodValues, ScalarSequence< double > &currLogTargetValues)
Generates the sequence at the level 0.
Definition: MLSampling.C:2298
const BaseVectorRV< P_V, P_M > & m_priorRv
Prior RV.
Definition: MLSampling.h:473
Base class for handling vector and array samples (sequence of vectors or arrays). ...
void checkpointML(double currExponent, double currEta, const SequenceOfVectors< P_V, P_M > &currChain, const ScalarSequence< double > &currLogLikelihoodValues, const ScalarSequence< double > &currLogTargetValues)
Writes checkpoint data for the ML method.
Definition: MLSampling.C:2011
MLSampling(const char *prefix, const BaseVectorRV< P_V, P_M > &priorRv, const BaseScalarFunction< P_V, P_M > &likelihoodFunction)
Constructor.
Definition: MLSampling.C:3985
unsigned int m_currLevel
Current level.
Definition: MLSampling.h:492
~MLSampling()
Destructor.
Definition: MLSampling.C:4018
A class for handling Bayesian joint PDFs.
void print(std::ostream &os) const
TODO: Prints the sequence.
VectorSet< P_V, P_M > * m_targetDomain
Domain of the target PDF: intersection of the domains of the prior PDf and likelihood function...
Definition: MLSampling.h:482
void BIP_routine(glp_tree *tree, void *info)
Definition: MLSampling.C:39
This class provides options for the Multilevel sequence generator if no input file is available...
A templated class that represents a Multilevel generator of samples.
Definition: MLSampling.h:122
Class for handling vector samples (sequence of vectors).
bool decideOnBalancedChains_all(const MLSamplingLevelOptions *currOptions, unsigned int indexOfFirstWeight, unsigned int indexOfLastWeight, const std::vector< unsigned int > &unifiedIndexCountersAtProc0Only, std::vector< ExchangeInfoStruct > &exchangeStdVec)
Definition: MLSampling.C:149
void solveBIP_proc0(std::vector< ExchangeInfoStruct > &exchangeStdVec)
Definition: MLSampling.C:1156
void prepareBalLinkedChains_inter0(const MLSamplingLevelOptions *currOptions, const SequenceOfVectors< P_V, P_M > &prevChain, double prevExponent, double currExponent, const ScalarSequence< double > &prevLogLikelihoodValues, const ScalarSequence< double > &prevLogTargetValues, std::vector< ExchangeInfoStruct > &exchangeStdVec, BalancedLinkedChainsPerNodeStruct< P_V > &balancedLinkControl)
Definition: MLSampling.C:330
const BaseEnvironment & m_env
Queso enviroment.
Definition: MLSampling.h:470
unsigned int numberOfPositions
Definition: MLSampling.h:71
void generateSequence(BaseVectorSequence< P_V, P_M > &workingChain, ScalarSequence< double > *workingLogLikelihoodValues, ScalarSequence< double > *workingLogTargetValues)
Method to generate the chain.
Definition: MLSampling.C:4030
double logEvidence() const
Method to calculate the logarithm of the evidence.
Definition: MLSampling.C:4830
MLSamplingOptions m_options
Options for the ML algorithm.
Definition: MLSampling.h:489
void generateSequence_Step10_all(MLSamplingLevelOptions &currOptions, const P_M &unifiedCovMatrix, const GenericVectorRV< P_V, P_M > &currRv, bool useBalancedChains, const UnbalancedLinkedChainsPerNodeStruct &unbalancedLinkControl, unsigned int indexOfFirstWeight, const SequenceOfVectors< P_V, P_M > &prevChain, double prevExponent, double currExponent, const ScalarSequence< double > &prevLogLikelihoodValues, const ScalarSequence< double > &prevLogTargetValues, const BalancedLinkedChainsPerNodeStruct< P_V > &balancedLinkControl, SequenceOfVectors< P_V, P_M > &currChain, double &cumulativeRawChainRunTime, unsigned int &cumulativeRawChainRejections, ScalarSequence< double > *currLogLikelihoodValues, ScalarSequence< double > *currLogTargetValues)
Samples the vector RV of current level (Step 10 from ML algorithm).
Definition: MLSampling.C:3705
This class provides options for each level of the Multilevel sequence generator if no input file is a...
This (virtual) class sets up the environment underlying the use of the QUESO library by an executable...
Definition: Environment.h:198
double eig() const
Calculates the expected information gain value, EIG.
Definition: MLSampling.C:4842

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