Skip to content

Commit 83a450a

Browse files
author
yiz
committed
ignore init buffer draws in mpi var adaptation
1 parent 92b8f3f commit 83a450a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/stan/mcmc/mpi_var_adaptation.hpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff 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;
2021
public:
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

0 commit comments

Comments
 (0)