pub struct Choice {
pub addr: Address,
pub value: ChoiceValue,
pub logp: f64,
}Expand description
A single recorded choice made during model execution.
Each Choice represents a random variable assignment at a specific address, complete with the value chosen and its log-probability. Choices form the building blocks of execution traces.
Example:
// Choices are typically created by handlers during execution
let choice = Choice {
addr: addr!("theta"),
value: ChoiceValue::F64(1.5),
logp: -0.918, // log-probability under generating distribution
};
println!("Choice at {}: {:?} (logp: {:.3})",
choice.addr, choice.value, choice.logp);
// Extract the value with type safety
if let Some(val) = choice.value.as_f64() {
println!("Theta value: {:.3}", val);
}Fields§
§addr: AddressAddress where this choice was made.
value: ChoiceValueValue that was chosen.
logp: f64Log-probability of this value under the generating distribution.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Choice
impl RefUnwindSafe for Choice
impl Send for Choice
impl Sync for Choice
impl Unpin for Choice
impl UnwindSafe for Choice
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more