MUQ  0.4.3
InferenceProblem.h
Go to the documentation of this file.
1 #ifndef INFERENCEPROBLEM_H_
2 #define INFERENCEPROBLEM_H_
3 
4 // include Density and not ModPiece so that if a SamplingProblem is constructed with a Density the compiler knows it is a child of ModPiece
7 
8 namespace muq {
9  namespace SamplingAlgorithms {
10 
26  public:
27 
33  InferenceProblem(std::shared_ptr<muq::Modeling::ModPiece> const& likelyIn,
34  std::shared_ptr<muq::Modeling::ModPiece> const& priorIn,
35  double inverseTempIn=1.0);
36 
43  InferenceProblem(std::shared_ptr<muq::Modeling::ModPiece> const& likelyIn,
44  std::shared_ptr<muq::Modeling::ModPiece> const& priorIn,
45  std::shared_ptr<muq::Modeling::ModPiece> const& qoiIn,
46  double inverseTempIn=1.0);
47 
48  virtual ~InferenceProblem() = default;
49 
50 
51  virtual double LogDensity(std::shared_ptr<SamplingState> const& state) override;
52 
53  virtual Eigen::VectorXd GradLogDensity(std::shared_ptr<SamplingState> const& state,
54  unsigned const blockWrt) override;
55 
56  virtual std::shared_ptr<SamplingState> QOI() override;
57 
58  std::shared_ptr<muq::Modeling::ModPiece> const& Likelihood() const{return likely;};
59  std::shared_ptr<muq::Modeling::ModPiece> const& Prior() const{return prior;};
60 
62  void SetInverseTemp(double newTemp){inverseTemp=newTemp;};
63 
65  double GetInverseTemp() const{return inverseTemp;}
66 
67  virtual std::shared_ptr<AbstractSamplingProblem> Clone() const override;
68 
69  protected:
70 
72  std::shared_ptr<muq::Modeling::ModPiece> likely;
73 
75  std::shared_ptr<muq::Modeling::ModPiece> prior;
76 
77  std::shared_ptr<muq::Modeling::ModPiece> qoi;
78 
79  double inverseTemp;
80 
81  private:
82 
83  std::shared_ptr<SamplingState> lastState;
84  };
85 
86  } // namespace SamplingAlgorithms
87 } // namespace muq
88 
89 #endif
Abstract base class for MCMC and Importance Sampling problems.
Class for sampling problems based on the product of a prior and likelihood, possibly with a tempering...
std::shared_ptr< muq::Modeling::ModPiece > likely
The log-likelihood function.
std::shared_ptr< muq::Modeling::ModPiece > qoi
std::shared_ptr< muq::Modeling::ModPiece > prior
The prior log-density.
virtual std::shared_ptr< AbstractSamplingProblem > Clone() const override
InferenceProblem(std::shared_ptr< muq::Modeling::ModPiece > const &likelyIn, std::shared_ptr< muq::Modeling::ModPiece > const &priorIn, double inverseTempIn=1.0)
virtual Eigen::VectorXd GradLogDensity(std::shared_ptr< SamplingState > const &state, unsigned const blockWrt) override
virtual double LogDensity(std::shared_ptr< SamplingState > const &state) override
virtual std::shared_ptr< SamplingState > QOI() override
std::shared_ptr< muq::Modeling::ModPiece > const & Likelihood() const
std::shared_ptr< muq::Modeling::ModPiece > const & Prior() const
std::shared_ptr< SamplingState > lastState