pub struct CatCPD { /* private fields */ }Expand description
A categorical CPD.
Implementations§
Source§impl CatCPD
impl CatCPD
Sourcepub fn new(
states: States,
conditioning_states: States,
parameters: Array2<f64>,
) -> Self
pub fn new( states: States, conditioning_states: States, parameters: Array2<f64>, ) -> Self
Creates a new categorical conditional probability distribution.
§Arguments
states- The variable label and states.conditioning_states- The conditioning variables labels and states.parameters- The probabilities of the states.
§Panics
- If the labels and conditioning labels are not disjoint.
- If the product of the shape of the of states does not match the number of columns.
- If the product of the shape of the of conditioning states does not match the number of rows.
- If the parameters do not sum to one by row, unless empty.
§Returns
A new CatCPD instance.
Sourcepub const fn multi_index(&self) -> &MI
pub const fn multi_index(&self) -> &MI
Returns the ravel multi index of the conditioning variables.
§Returns
The ravel multi index of the conditioning variables.
Sourcepub const fn conditioning_states(&self) -> &States
pub const fn conditioning_states(&self) -> &States
Returns the states of the conditioning variables.
§Returns
The states of the conditioning variables.
Sourcepub const fn conditioning_shape(&self) -> &Array1<usize>
pub const fn conditioning_shape(&self) -> &Array1<usize>
Sourcepub const fn conditioning_multi_index(&self) -> &MI
pub const fn conditioning_multi_index(&self) -> &MI
Returns the ravel multi index of the conditioning variables.
§Returns
The ravel multi index of the conditioning variables.
Sourcepub fn with_optionals(
state: States,
conditioning_states: States,
parameters: Array2<f64>,
sample_statistics: Option<CatCPDS>,
sample_log_likelihood: Option<f64>,
) -> Self
pub fn with_optionals( state: States, conditioning_states: States, parameters: Array2<f64>, sample_statistics: Option<CatCPDS>, sample_log_likelihood: Option<f64>, ) -> Self
Creates a new categorical conditional probability distribution with optional fields.
§Arguments
states- The variables states.parameters- The probabilities of the states.statistics- The sufficient statistics used to fit the distribution, if any.
§Panics
See new method for panics.
§Returns
A new CatCPD instance.
Trait Implementations§
Source§impl AbsDiffEq for CatCPD
impl AbsDiffEq for CatCPD
Source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
The default tolerance to use when testing values that are close together. Read more
Source§fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
A test for equality that uses the absolute difference to compute the approximate
equality of two numbers.
Source§fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
The inverse of
AbsDiffEq::abs_diff_eq.Source§impl CPD for CatCPD
impl CPD for CatCPD
Source§type Statistics = CatCPDS
type Statistics = CatCPDS
The type of the sufficient statistics.
Source§fn conditioning_labels(&self) -> &Labels
fn conditioning_labels(&self) -> &Labels
Returns the labels of the conditioned variables. Read more
Source§fn parameters(&self) -> &Self::Parameters
fn parameters(&self) -> &Self::Parameters
Returns the parameters. Read more
Source§fn parameters_size(&self) -> usize
fn parameters_size(&self) -> usize
Returns the parameters size. Read more
Source§fn sample_statistics(&self) -> Option<&Self::Statistics>
fn sample_statistics(&self) -> Option<&Self::Statistics>
Returns the sufficient statistics, if any. Read more
Source§fn sample_log_likelihood(&self) -> Option<f64>
fn sample_log_likelihood(&self) -> Option<f64>
Returns the log-likelihood of the fitted dataset, if any. Read more
Source§impl CPDEstimator<CatCPD> for BE<'_, CatWtdTable, ()>
impl CPDEstimator<CatCPD> for BE<'_, CatWtdTable, ()>
Source§impl CPDEstimator<CatCPD> for BE<'_, CatWtdTable, usize>
impl CPDEstimator<CatCPD> for BE<'_, CatWtdTable, usize>
Source§impl CPDEstimator<CatCPD> for MLE<'_, CatWtdTable>
impl CPDEstimator<CatCPD> for MLE<'_, CatWtdTable>
Source§impl<'de> Deserialize<'de> for CatCPD
impl<'de> Deserialize<'de> for CatCPD
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonIO for CatCPD
impl JsonIO for CatCPD
Source§fn write_json(&self, path: &str)
fn write_json(&self, path: &str)
Write the instance to a JSON file. Read more
Source§impl Labelled for CatCPD
impl Labelled for CatCPD
Source§fn label_to_index(&self, x: &str) -> usize
fn label_to_index(&self, x: &str) -> usize
Return the variable index for a given label. Read more
Source§fn index_to_label(&self, x: usize) -> &str
fn index_to_label(&self, x: usize) -> &str
Return the label for a given variable index. Read more
Source§fn index_to(&self, x: usize, other: &Labels) -> usize
fn index_to(&self, x: usize, other: &Labels) -> usize
Maps an index from this model to another model with the same label. Read more
Source§fn indices_to(&self, x: &Set<usize>, other: &Labels) -> Set<usize>
fn indices_to(&self, x: &Set<usize>, other: &Labels) -> Set<usize>
Maps a set of indices from this model to another model with the same labels. Read more
Source§impl ParCPDEstimator<CatCPD> for BE<'_, CatWtdTable, ()>
impl ParCPDEstimator<CatCPD> for BE<'_, CatWtdTable, ()>
Source§impl ParCPDEstimator<CatCPD> for BE<'_, CatWtdTable, usize>
impl ParCPDEstimator<CatCPD> for BE<'_, CatWtdTable, usize>
Source§impl ParCPDEstimator<CatCPD> for MLE<'_, CatWtdTable>
impl ParCPDEstimator<CatCPD> for MLE<'_, CatWtdTable>
Source§impl RelativeEq for CatCPD
impl RelativeEq for CatCPD
Source§fn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
The default relative tolerance for testing values that are far-apart. Read more
Source§fn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon,
) -> bool
fn relative_eq( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool
A test for equality that uses a relative comparison if the values are far apart.
Source§fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon,
) -> bool
fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool
The inverse of
RelativeEq::relative_eq.Auto Trait Implementations§
impl Freeze for CatCPD
impl RefUnwindSafe for CatCPD
impl Send for CatCPD
impl Sync for CatCPD
impl Unpin for CatCPD
impl UnwindSafe for CatCPD
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 more