pub struct BocpdDetector { /* private fields */ }Expand description
Bayesian Online Change-Point Detection for regime classification.
Maintains a truncated run-length posterior and computes the probability of being in burst vs steady regime.
Implementations§
Source§impl BocpdDetector
impl BocpdDetector
Sourcepub fn new(config: BocpdConfig) -> Self
pub fn new(config: BocpdConfig) -> Self
Create a new BOCPD detector with the given configuration.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create with default configuration.
Sourcepub fn run_length_posterior(&self) -> &[f64]
pub fn run_length_posterior(&self) -> &[f64]
Get the run-length posterior distribution.
Returns a slice where element i is P(r_t = i | x_1:t).
The length is bounded by max_run_length + 1.
Sourcepub fn regime(&self) -> BocpdRegime
pub fn regime(&self) -> BocpdRegime
Get current classified regime.
Sourcepub fn expected_run_length(&self) -> f64
pub fn expected_run_length(&self) -> f64
Get the expected run-length (mean of posterior).
Sourcepub fn last_evidence(&self) -> Option<&BocpdEvidence>
pub fn last_evidence(&self) -> Option<&BocpdEvidence>
Get the last evidence.
Sourcepub fn set_decision_context(
&mut self,
steady_delay_ms: u64,
burst_delay_ms: u64,
hard_deadline_forced: bool,
)
pub fn set_decision_context( &mut self, steady_delay_ms: u64, burst_delay_ms: u64, hard_deadline_forced: bool, )
Update the last evidence with decision context (delay + deadline).
Call this after a decision is made (e.g., in the coalescer) to include chosen delay and hard-deadline forcing in JSONL logs.
Sourcepub fn evidence_jsonl(&self) -> Option<String>
pub fn evidence_jsonl(&self) -> Option<String>
Return the latest JSONL evidence entry if logging is enabled.
Sourcepub fn decision_log_jsonl(
&self,
steady_delay_ms: u64,
burst_delay_ms: u64,
hard_deadline_forced: bool,
) -> Option<String>
pub fn decision_log_jsonl( &self, steady_delay_ms: u64, burst_delay_ms: u64, hard_deadline_forced: bool, ) -> Option<String>
Return JSONL evidence with decision context applied.
Sourcepub fn observation_count(&self) -> u64
pub fn observation_count(&self) -> u64
Get observation count.
Sourcepub fn config(&self) -> &BocpdConfig
pub fn config(&self) -> &BocpdConfig
Get configuration.
Sourcepub fn observe_event(&mut self, now: Instant) -> BocpdRegime
pub fn observe_event(&mut self, now: Instant) -> BocpdRegime
Process a new resize event.
Call this when a resize event occurs. Returns the classified regime.
Sourcepub fn recommended_delay(
&self,
steady_delay_ms: u64,
burst_delay_ms: u64,
) -> u64
pub fn recommended_delay( &self, steady_delay_ms: u64, burst_delay_ms: u64, ) -> u64
Compute recommended coalesce delay based on current regime.
Interpolates between steady_delay and burst_delay based on p_burst.
Trait Implementations§
Source§impl Clone for BocpdDetector
impl Clone for BocpdDetector
Source§fn clone(&self) -> BocpdDetector
fn clone(&self) -> BocpdDetector
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more