pub struct BocpdTruncated<X, Fx, Pr>where
    Fx: Rv<X> + HasSuffStat<X>,
    Pr: ConjugatePrior<X, Fx>,
    Fx::Stat: Clone,{ /* private fields */ }
Expand description

Online Bayesian Change Point Detection with a truncated tail

The truncation takes place after run length probabilites are computed. The truncation point is chosen based on the most recent point from which all successive mass is below the given threshold.

Implementations§

source§

impl<X, Fx, Pr> BocpdTruncated<X, Fx, Pr>where Fx: Rv<X> + HasSuffStat<X>, Pr: ConjugatePrior<X, Fx, Posterior = Pr> + Clone, Fx::Stat: Clone,

source

pub fn new(hazard_lambda: f64, predictive_prior: Pr) -> Self

Create a new Bocpd analyzer

Parameters
  • hazard - The hazard function for P_{gap} = 1/hazard.
  • predictive_prior - Prior for the predictive distribution.
Example
use changepoint::BocpdTruncated;
use rv::prelude::*;

let cpd = BocpdTruncated::new(
    250.0,
    NormalGamma::new_unchecked(0.0, 1.0, 1.0, 1.0),
);
source

pub fn with_cutoff(self, cutoff_threadhold: f64) -> Self

Change the cutoff for mass to be discarded on the tail end of run-lengths

source

pub fn reset_with_prior(&mut self, predictive_prior: Pr)

Reset the introspector and replace the predictive prior

source§

impl<X, Fx, Pr> BocpdTruncated<X, Fx, Pr>where Fx: Rv<X> + HasSuffStat<X>, Pr: ConjugatePrior<X, Fx, Posterior = Pr> + Clone, Fx::Stat: Clone,

source

pub fn collapse_stats(self) -> Self

Reduce the observed values into a new BOCPD with those observed values integrated into the prior.

Trait Implementations§

source§

impl<X, Fx, Pr> BocpdLike<X> for BocpdTruncated<X, Fx, Pr>where Fx: Rv<X> + HasSuffStat<X>, Pr: ConjugatePrior<X, Fx, Posterior = Pr> + Clone, Fx::Stat: Clone,

source§

fn step(&mut self, data: &X) -> &[f64]

Update the model with a new datum and return the distribution of run lengths.

§

type Fx = Fx

Type of type of distribution
§

type PosteriorPredictive = Mixture<Pr>

Type of predictive prior distribution
source§

fn reset(&mut self)

Reset internal state, new run-lengths will refer to steps after this point.
source§

fn pp(&self) -> Self::PosteriorPredictive

Generate the posterior predictive distribution
source§

fn preload(&mut self, data: &[X])

Preload a seqeunce into the default suff stat
source§

impl<X: Clone, Fx, Pr> Clone for BocpdTruncated<X, Fx, Pr>where Fx: Rv<X> + HasSuffStat<X> + Clone, Pr: ConjugatePrior<X, Fx> + Clone, Fx::Stat: Clone + Clone,

source§

fn clone(&self) -> BocpdTruncated<X, Fx, Pr>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<X: Debug, Fx, Pr> Debug for BocpdTruncated<X, Fx, Pr>where Fx: Rv<X> + HasSuffStat<X> + Debug, Pr: ConjugatePrior<X, Fx> + Debug, Fx::Stat: Clone + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<X, Fx, Pr> RefUnwindSafe for BocpdTruncated<X, Fx, Pr>where Pr: RefUnwindSafe, <Fx as HasSuffStat<X>>::Stat: RefUnwindSafe,

§

impl<X, Fx, Pr> Send for BocpdTruncated<X, Fx, Pr>where Pr: Send, <Fx as HasSuffStat<X>>::Stat: Send,

§

impl<X, Fx, Pr> Sync for BocpdTruncated<X, Fx, Pr>where Pr: Sync, <Fx as HasSuffStat<X>>::Stat: Sync,

§

impl<X, Fx, Pr> Unpin for BocpdTruncated<X, Fx, Pr>where Pr: Unpin, <Fx as HasSuffStat<X>>::Stat: Unpin,

§

impl<X, Fx, Pr> UnwindSafe for BocpdTruncated<X, Fx, Pr>where Pr: UnwindSafe, <Fx as HasSuffStat<X>>::Stat: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> Same<T> for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.
§

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

§

fn vzip(self) -> V

§

impl<T> SendAlias for T

§

impl<T> SendSyncUnwindSafe for Twhere T: Send + Sync + UnwindSafe + ?Sized,

§

impl<T> SyncAlias for T