File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -17,22 +17,26 @@ namespace mcmc {
1717#ifdef STAN_LANG_MPI
1818 using est_t = stan::math::mpi::mpi_var_estimator;
1919
20+ int init_draw_counter;
2021public:
2122 std::vector<est_t > estimators;
2223
2324 mpi_var_adaptation () = default;
2425
2526 mpi_var_adaptation (int n_params, int max_num_windows)
26- : estimators(max_num_windows, est_t (n_params))
27+ : init_draw_counter( 0 ), estimators(max_num_windows, est_t (n_params))
2728 {}
2829
2930 mpi_var_adaptation (int n_params, int num_iterations, int window_size)
3031 : mpi_var_adaptation(n_params, num_iterations / window_size)
3132 {}
3233
3334 virtual void add_sample (const Eigen::VectorXd& q, int curr_win_count) {
34- for (int win = 0 ; win < curr_win_count; ++win) {
35- estimators[win].add_sample (q);
35+ init_draw_counter++;
36+ if (init_draw_counter > init_bufer_size) {
37+ for (int win = 0 ; win < curr_win_count; ++win) {
38+ estimators[win].add_sample (q);
39+ }
3640 }
3741 }
3842
You can’t perform that action at this time.
0 commit comments