Conversation
46203f6 to
ce92b91
Compare
Extend ChainProgress with optional latest_sample field instead of adding separate SampleCallback. Consolidates callback API while maintaining access to per-sample data.
ce92b91 to
51fd3cb
Compare
| pub runtime: Duration, | ||
| pub divergent_draws: Vec<usize>, | ||
| /// The most recent sample from this chain (if available) | ||
| pub latest_sample: Option<SampleData>, |
There was a problem hiding this comment.
I like the idea of having a separate struct for the draw specific entries, but we should then also move the existing ones into the struct. I don't think we have to worry about backward compatibility here too much, and nuts-rs is still pre-1.0. (But maybe we should change that soonish...)
And do we really need to store the position? I can't really think of anything useful to do with it, given that it's just the unconstrained flattened parameters without any labels. Do you have a specific use-case in mind?
There was a problem hiding this comment.
Removed the position and renamed to be closed to PyMC sampler names.
src/sampler.rs
Outdated
| None | ||
| } | ||
| }) | ||
| .unwrap_or(0); |
There was a problem hiding this comment.
I don't think adding zeros is good here. I'm currently working on other samplers for instance, and they might not have all of those. Maybe just make the stats optional? (ie Option instead of f64)
| chains.iter().map(|chain| chain.progress()).collect_vec(); | ||
| responses_tx.send(SamplerResponse::Progress(progress.into())).map_err(|e| { | ||
| anyhow::anyhow!( | ||
| responses_tx |
There was a problem hiding this comment.
Looks like some unrelated formatting changes slipped in?
There was a problem hiding this comment.
I had a bit of a hard time getting the env setup locally. But did run cargo fmt
|
Coverage is failing for some reason. .. Maybe I should have forked... Logs: https://github.com/pymc-devs/nuts-rs/actions/runs/23067147874 |
Getting ball rolling for pymc-devs/nutpie#166
This creates a new constructor
new_with_sample_callbackin order to keep backwardscompatibility.