15 template<
typename HYP>
17 const std::vector<typename HYP::data_t*>& mcmc_data,
19 const std::vector<size_t>
ntop) {
20 assert(not ntop.empty());
23 auto maxntop = *std::max_element(ntop.begin(), ntop.end());
25 std::vector<std::set<HYP>> out(ntop.size());
27 #pragma omp parallel for 28 for(
size_t vi=0; vi<mcmc_data.size();vi++) {
29 if(
CTRL_C) std::terminate();
33 print(
"# Running ", vi,
" of ", mcmc_data.size(), mcmc_data[vi]);
38 for(
size_t di=0;di<=mcmc_data[vi]->size() and !
CTRL_C;di++) {
44 HYP myh0 = h0.restart();
45 auto givendata =
slice(*(mcmc_data[vi]), 0, di);
58 for(
size_t t=0;t<ntop.size();t++) {
63 for(
auto h : mytop.
values()) {
76 template<
typename HYP>
79 assert(v.size() == 1);
unsigned long print
Definition: FleetArgs.h:34
void UNUSED(const T &x)
Definition: Miscellaneous.h:38
#define TAB
Definition: IO.h:19
std::vector< std::set< HYP > > get_hypotheses_from_mcmc(const HYP &h0, const std::vector< typename HYP::data_t *> &mcmc_data, Control c, const std::vector< size_t > ntop)
Runs MCMC on hypotheses, resampling when the data stops being incremental and returns a unioned vecto...
Definition: Batch.h:16
Definition: SampleStreams.h:66
const std::set< T > & values() const
Definition: TopN.h:112
unsigned long ntop
Definition: FleetArgs.h:15
Definition: MCMCChain.h:23
volatile sig_atomic_t CTRL_C
std::vector< T > slice(const std::vector< T > &v, const size_t start, const int len)
Definition: Vectors.h:6
void print(FIRST f, ARGS... args)
Lock output_lock and print to std:cout.
Definition: IO.h:53
#define ENDL
Definition: IO.h:21
generator< HYP & > run(Control ctl)
Run MCMC according to the control parameters passed in. NOTE: ctl cannot be passed by reference...
Definition: MCMCChain.h:153
#define COUT
Definition: IO.h:24
This represents an MCMC hain on a hypothesis of type HYP. It uses HYP::propose and HYP::compute_poste...
A human data series contains a list of human data points, some of which may be presented at the same ...
This class has all the information for running MCMC or MCTS in a little package. It defaultly constru...