Skip to main content

ReconcilingScoreGivenTrace

Struct ReconcilingScoreGivenTrace 

Source
pub struct ReconcilingScoreGivenTrace<'r, 'f, 'e, R: RngCore> {
    pub rng: &'r mut R,
    pub base: Trace,
    pub trace: Trace,
    /* private fields */
}
Expand description

The reconciling sibling of ScoreGivenTrace, backing score_given_trace_reconciled.

Addresses present in the base trace are replayed and re-scored. NEW addresses (absent, or present with a different value type) are sampled fresh from the prior, their log_prob accumulated into log_prior, and recorded in fresh. A duplicate address is still an error.

Fields§

§rng: &'r mut R

RNG used to propose fresh values for new addresses.

§base: Trace

Base trace containing the fixed choices to replay/score.

§trace: Trace

New trace accumulating the reconciled execution.

Trait Implementations§

Source§

impl<'r, 'f, 'e, R: RngCore> Handler for ReconcilingScoreGivenTrace<'r, 'f, 'e, R>

Source§

fn on_sample_f64(&mut self, addr: &Address, dist: &dyn Distribution<f64>) -> f64

Handle an f64 sampling operation (continuous distributions).
Source§

fn on_sample_bool( &mut self, addr: &Address, dist: &dyn Distribution<bool>, ) -> bool

Handle a bool sampling operation (Bernoulli).
Source§

fn on_sample_u64(&mut self, addr: &Address, dist: &dyn Distribution<u64>) -> u64

Handle a u64 sampling operation (Poisson, Binomial).
Source§

fn on_sample_usize( &mut self, addr: &Address, dist: &dyn Distribution<usize>, ) -> usize

Handle a usize sampling operation (Categorical).
Source§

fn on_sample_i64(&mut self, addr: &Address, dist: &dyn Distribution<i64>) -> i64

Handle an i64 sampling operation (signed discrete distributions). Read more
Source§

fn on_observe_f64( &mut self, _addr: &Address, dist: &dyn Distribution<f64>, value: f64, )

Handle an f64 observation operation.
Source§

fn on_observe_bool( &mut self, _addr: &Address, dist: &dyn Distribution<bool>, value: bool, )

Handle a bool observation operation.
Source§

fn on_observe_u64( &mut self, _addr: &Address, dist: &dyn Distribution<u64>, value: u64, )

Handle a u64 observation operation.
Source§

fn on_observe_usize( &mut self, _addr: &Address, dist: &dyn Distribution<usize>, value: usize, )

Handle a usize observation operation.
Source§

fn on_observe_i64( &mut self, _addr: &Address, dist: &dyn Distribution<i64>, value: i64, )

Handle an i64 observation operation. Read more
Source§

fn on_factor(&mut self, logw: f64)

Handle a factor operation. Read more
Source§

fn finish(self) -> Trace

Finalize the handler and return the accumulated trace. Read more

Auto Trait Implementations§

§

impl<'r, 'f, 'e, R> !UnwindSafe for ReconcilingScoreGivenTrace<'r, 'f, 'e, R>

§

impl<'r, 'f, 'e, R> Freeze for ReconcilingScoreGivenTrace<'r, 'f, 'e, R>

§

impl<'r, 'f, 'e, R> RefUnwindSafe for ReconcilingScoreGivenTrace<'r, 'f, 'e, R>
where R: RefUnwindSafe,

§

impl<'r, 'f, 'e, R> Send for ReconcilingScoreGivenTrace<'r, 'f, 'e, R>
where R: Send,

§

impl<'r, 'f, 'e, R> Sync for ReconcilingScoreGivenTrace<'r, 'f, 'e, R>
where R: Sync,

§

impl<'r, 'f, 'e, R> Unpin for ReconcilingScoreGivenTrace<'r, 'f, 'e, R>

§

impl<'r, 'f, 'e, R> UnsafeUnpin for ReconcilingScoreGivenTrace<'r, 'f, 'e, R>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V