Phi

Trait Phi 

Source
pub trait Phi:
    Clone
    + Debug
    + Labelled
    + PartialEq
    + AbsDiffEq
    + RelativeEq
    + for<'a> MulAssign<&'a Self>
    + for<'a> DivAssign<&'a Self> {
    type CPD;
    type Parameters;
    type Evidence;

    // Required methods
    fn parameters(&self) -> &Self::Parameters;
    fn parameters_size(&self) -> usize;
    fn condition(&self, e: &Self::Evidence) -> Self;
    fn marginalize(&self, x: &Set<usize>) -> Self;
    fn normalize(&self) -> Self;
    fn from_cpd(cpd: Self::CPD) -> Self;
    fn into_cpd(self, x: &Set<usize>, z: &Set<usize>) -> Self::CPD;
}
Expand description

A trait for potential functions.

Required Associated Types§

Source

type CPD

The type of the CPD.

Source

type Parameters

The type of the parameters.

Source

type Evidence

The type of the evidence.

Required Methods§

Source

fn parameters(&self) -> &Self::Parameters

Returns the parameters.

§Returns

A reference to the parameters.

Source

fn parameters_size(&self) -> usize

Returns the parameters size.

§Returns

The parameters size.

Source

fn condition(&self, e: &Self::Evidence) -> Self

Conditions the potential on a set of variables.

§Arguments
  • e - A map from variable indices to their observed states.
§Returns

A new potential instance.

Source

fn marginalize(&self, x: &Set<usize>) -> Self

Marginalizes the potential over a set of variables.

§Arguments
  • x - A set of variable indices to marginalize over.
§Returns

A new potential instance.

Source

fn normalize(&self) -> Self

Normalizes the potential.

§Returns

The normalized potential.

Source

fn from_cpd(cpd: Self::CPD) -> Self

Converts a CPD P(X | Z) to a potential \phi(X \cup Z).

§Arguments
  • cpd - The CPD to convert.
§Returns

The corresponding potential.

Source

fn into_cpd(self, x: &Set<usize>, z: &Set<usize>) -> Self::CPD

Converts a potential \phi(X \cup Z) to a CPD P(X | Z).

§Arguments
  • x - The set of variables.
  • z - The set of conditioning variables.
§Returns

The corresponding CPD.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§