[−][src]Struct loopybayesnet::LogProbVector
The representation of a probability vector in log-space
Log-space manipulation of probabilitys is stabler regarding vectors
with values very close to 0 or 1. This uses the natural logarithm (base e
).
The content of this log-proba vector may not be normalized: adding a constant value to all entries of the vector does not change the normalized probability it represents.
Methods
impl LogProbVector
[src]
pub fn uniform(n: usize) -> LogProbVector
[src]
Create an unnormalized log-probability vector representing an uniform distribution
pub fn deterministic(n: usize, i: usize) -> LogProbVector
[src]
Create an unnormalized log-probability vector representing a deterministic distribution
choosing value i
from the n
possible
If i >= n
, this returns a vector assigning 0 probability to every value.
pub fn from_log_probabilities(log_probabilities: Array1<f32>) -> LogProbVector
[src]
Wrap an array of log-probabilities into a log-probability vector
pub fn log_probabilities(&self) -> ArrayView1<f32>
[src]
Access the underlying array of log-probas
pub fn as_probabilities(&self) -> Array1<f32>
[src]
Get the normalized probabilities represented by this log-probability vector
pub fn renormalize(&mut self)
[src]
Renormalize the log-probability vector so that its content represent exactly the log of a normalized probability distribution.
pub fn prod(&mut self, other: &LogProbVector)
[src]
Multiply the given log-probability vector into this one.
NB: Multiplication is done in probability space, hence the log-probabilities are summed As a result, the log-probability vector will no longer be normalized if it was.
pub fn reset(&mut self)
[src]
Resets this log-probas vector to a uniform distribution
Trait Implementations
impl Clone for LogProbVector
[src]
fn clone(&self) -> LogProbVector
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for LogProbVector
[src]
Auto Trait Implementations
impl Send for LogProbVector
impl Unpin for LogProbVector
impl Sync for LogProbVector
impl UnwindSafe for LogProbVector
impl RefUnwindSafe for LogProbVector
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,