pub struct Hmm {
pub pi: Vec<f64>,
pub a: Vec<f64>,
pub b: Vec<f64>,
pub k: usize,
pub m: usize,
}Expand description
A discrete HMM: k hidden states, m observation symbols.
Fields§
§pi: Vec<f64>Initial state distribution π (length k).
a: Vec<f64>Row-major k×k transition matrix A (a[i*k+j] = P(state j | state i)).
b: Vec<f64>Row-major k×m emission matrix B (b[i*m+o] = P(symbol o | state i)).
k: usize§m: usizeImplementations§
Source§impl Hmm
impl Hmm
Sourcepub fn new(
pi: Vec<f64>,
a: Vec<f64>,
b: Vec<f64>,
k: usize,
m: usize,
) -> Result<Self, LearningError>
pub fn new( pi: Vec<f64>, a: Vec<f64>, b: Vec<f64>, k: usize, m: usize, ) -> Result<Self, LearningError>
Construct from parameters, validating shapes (rows need not be exactly normalized but must be non-empty).
Sourcepub fn log_likelihood(&self, obs: &[usize]) -> Option<f64>
pub fn log_likelihood(&self, obs: &[usize]) -> Option<f64>
Log-likelihood log P(obs | model). None for an empty sequence or an
out-of-range symbol.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Hmm
impl RefUnwindSafe for Hmm
impl Send for Hmm
impl Sync for Hmm
impl Unpin for Hmm
impl UnsafeUnpin for Hmm
impl UnwindSafe for Hmm
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more