Skip to content

Commit 9a7261f

Browse files
committed
feat: Add index of divergent draws to progress
1 parent 53e4d0b commit 9a7261f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/sampler.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ pub struct ChainProgress {
224224
pub total_num_steps: usize,
225225
pub step_size: f64,
226226
pub runtime: Duration,
227+
pub divergent_draws: Vec<usize>,
227228
}
228229

229230
impl ChainProgress {
@@ -238,14 +239,16 @@ impl ChainProgress {
238239
step_size: 0f64,
239240
total_num_steps: 0,
240241
runtime: Duration::ZERO,
242+
divergent_draws: Vec::new(),
241243
}
242244
}
243245

244246
fn update(&mut self, stats: &SampleStats, draw_duration: Duration) {
245-
self.finished_draws += 1;
246247
if stats.diverging & !stats.tuning {
247248
self.divergences += 1;
249+
self.divergent_draws.push(self.finished_draws);
248250
}
251+
self.finished_draws += 1;
249252
self.tuning = stats.tuning;
250253

251254
self.latest_num_steps = stats.num_steps;

0 commit comments

Comments
 (0)