Class mcmc_para_emu (o2scl)

O2scl : Class List

template<class func_t, class fill_t, class data_t, class vec_t = ubvector>
class mcmc_para_emu : public o2scl::mcmc_para_cli<std::function<int(size_t, const ubvector&, double&, data_t&)>, fill_t, data_t, ubvector>

MCMC with an emulator.

Note

OpenMP threading probably doesn’t work yet.

Constructor and destructor

std::vector<std::shared_ptr<interpm_base<ubvector, o2scl::const_matrix_view_table<>, o2scl::matrix_view_table<>>>> emu

List of shared pointers to the interpolators, one for each OpenMP thread.

std::vector<std::shared_ptr<classify_python<ubvector, ubvector_int, o2scl::const_matrix_view_table<>, o2scl::matrix_view_table<>>>> emuc

List of shared pointers to the classifiers, one for each OpenMP thread.

inline mcmc_para_emu()
inline virtual ~mcmc_para_emu()
inline virtual int point_wrapper(size_t it, size_t np, const vec_t &p, double &log_wgt, data_t &dat)

Wrapper to the point function which uses the emulator.

inline virtual void outside_parallel()

Update the emulator outside the parallel region.

inline virtual int add_line(const vec_t &pars, double log_weight, size_t walker_ix, int func_ret, bool mcmc_accept, data_t &dat, size_t i_thread, fill_t &fill)

The function to add a line to the table.

This function computes the full likelihood in case of an acceptance.

inline void emu_train()

Train the emulator.

inline void emuc_train()

Train the classifier.

inline int mcmc_emu(size_t n_params_local, vec_t &low, vec_t &high, std::vector<func_t> &func, std::vector<fill_t> &fill, std::vector<data_t> &data)

The new MCMC function.

Public Types

typedef std::function<int(size_t, const vec_t&, double&, data_t&)> internal_point_t
typedef mcmc_para_cli<std::function<int(size_t, const vec_t&, double&, data_t&)>, fill_t, data_t, vec_t> parent_t

Public Members

std::string emu_file

File containing the training data for the emulator.

std::string emuc_file

File containing the training data for the classifier.

size_t max_train_size

Maximum size of training tables (default 1000)

size_t n_retrain

Number of iterations before retraining (default 1000)

A value of 0 skips the emulator and classifer completely and runs only the user-specified function.

bool use_classifier

If true, use a classifier (default false)

int show_emu

If true, show the emulator accuracy (default 0)

Protected Attributes

o2scl::table_units emu_table

Table containing training data for the emulator.

o2scl::table_units emu_init

Table containing initial emulator training file.

o2scl::table_units emuc_table

Table containing training data for the classifier.

o2scl::table_units emuc_init

Table containing initial classifier training file.

size_t n_rows_emu_init

The number of rows in the original training data file.

size_t n_rows_emuc_init

The number of rows in the original training data file.

std::vector<func_t> *func_ptr

Pointer to the user-specified function array.

size_t n_params_child

The number of parameters.

size_t last_retrain_sum

Sum at last retraining.

size_t n_total_emu
size_t n_total_class
size_t n_class_reject
size_t n_exact