pub struct GammaPoissonObservation {
pub rate_variable: String,
pub observations: Vec<u64>,
}Expand description
GammaPoissonObservation captures a Poisson likelihood y ~ Poisson(λ)
where the rate λ is a GammaNP variable. It contributes
(Σ y_i, N) to the posterior natural parameters, i.e. adds Σ y_i to
(α − 1) and N to −(−β) = β.
A factor holds a reference to its Gamma-distributed rate variable and a (possibly empty) batch of observations. Posterior inference combining prior + factor is exact in one VMP sweep because Poisson is conjugate to Gamma.
Fields§
§rate_variable: StringName of the GammaNP variable in the VMP graph.
observations: Vec<u64>Observed Poisson counts.
Implementations§
Source§impl GammaPoissonObservation
impl GammaPoissonObservation
Sourcepub fn new(rate_variable: impl Into<String>, observations: Vec<u64>) -> Self
pub fn new(rate_variable: impl Into<String>, observations: Vec<u64>) -> Self
Build a new Gamma-Poisson observation factor.
Sourcepub fn count_sum(&self) -> u64
pub fn count_sum(&self) -> u64
Sum of observed counts Σ y_i. Used as the shape-parameter increment.
Sourcepub fn num_observations(&self) -> usize
pub fn num_observations(&self) -> usize
Number of observations N. Used as the rate-parameter increment.
Trait Implementations§
Source§impl Clone for GammaPoissonObservation
impl Clone for GammaPoissonObservation
Source§fn clone(&self) -> GammaPoissonObservation
fn clone(&self) -> GammaPoissonObservation
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for GammaPoissonObservation
impl RefUnwindSafe for GammaPoissonObservation
impl Send for GammaPoissonObservation
impl Sync for GammaPoissonObservation
impl Unpin for GammaPoissonObservation
impl UnsafeUnpin for GammaPoissonObservation
impl UnwindSafe for GammaPoissonObservation
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.