Fleet  0.0.9
Inference in the LOT
MCMCable.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <optional>
4 #include "Bayesable.h"
5 
13 template<typename this_t, typename... Args>
14 class MCMCable : public Bayesable<Args...> {
15 public:
16  MCMCable() { }
17 
18  // these are declared nodiscard (and must be in subclasses too) to help remind that they do NOT modify the hypothesis,
19  // instead they return a new one
20  [[nodiscard]] virtual std::optional<std::pair<this_t,double>> propose() const = 0; // return a proposal and its forward-backward probs
21  [[nodiscard]] virtual this_t restart() const = 0; // restart a new chain -- typically by sampling from the prior, but actually it only resamples can_resample
22  virtual bool operator==(const this_t& h) const = 0; // speeds up a check in MCMC
23 
29  [[nodiscard]] static this_t sample() {
30  assert(false && "*** This should not be called -- must be overwritten in derived class");
31  }
32 
33 
34  virtual bool operator!=(const this_t& h) const {
35  return not this->operator==(h);
36  }
37 };
38 
39 
40 
virtual std::optional< std::pair< this_t, double > > propose() const =0
static this_t sample()
Static function for making a hypothesis. Be careful using this with references because they may not f...
Definition: MCMCable.h:29
Definition: MCMCable.h:14
MCMCable()
Definition: MCMCable.h:16
virtual bool operator!=(const this_t &h) const
Definition: MCMCable.h:34
Definition: Bayesable.h:33
virtual this_t restart() const =0
The Bayesable class provides an interface for hypotheses that support Bayesian inference (e...
virtual bool operator==(const this_t &h) const =0