Skip to content

Commit

Permalink
feat: Add index of divergent draws to progress
Browse files Browse the repository at this point in the history
  • Loading branch information
aseyboldt committed Apr 16, 2024
1 parent 53e4d0b commit 9a7261f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/sampler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ pub struct ChainProgress {
pub total_num_steps: usize,
pub step_size: f64,
pub runtime: Duration,
pub divergent_draws: Vec<usize>,
}

impl ChainProgress {
Expand All @@ -238,14 +239,16 @@ impl ChainProgress {
step_size: 0f64,
total_num_steps: 0,
runtime: Duration::ZERO,
divergent_draws: Vec::new(),
}
}

fn update(&mut self, stats: &SampleStats, draw_duration: Duration) {
self.finished_draws += 1;
if stats.diverging & !stats.tuning {
self.divergences += 1;
self.divergent_draws.push(self.finished_draws);
}
self.finished_draws += 1;
self.tuning = stats.tuning;

self.latest_num_steps = stats.num_steps;
Expand Down

0 comments on commit 9a7261f

Please sign in to comment.