pub struct BayesianNetwork {
pub nodes: Vec<BnNode>,
}Expand description
A Bayesian Network: directed acyclic graph with conditional probability tables.
Supports exact inference via variable elimination on small networks and loopy belief propagation on larger ones.
Fields§
§nodes: Vec<BnNode>Nodes in topological order.
Implementations§
Source§impl BayesianNetwork
impl BayesianNetwork
Sourcepub fn joint_probability(&self, assignment: &[usize]) -> f64
pub fn joint_probability(&self, assignment: &[usize]) -> f64
Computes the joint probability of a complete assignment.
assignment[i] is the state of node i.
Sourcepub fn marginal(&self, target: usize, target_state: usize) -> f64
pub fn marginal(&self, target: usize, target_state: usize) -> f64
Computes the marginal probability of node target being in state
by summing over all other assignments (exact, exponential complexity).
Sourcepub fn marginal_all(&self, target: usize) -> Vec<f64>
pub fn marginal_all(&self, target: usize) -> Vec<f64>
Returns marginal probabilities for all states of node target.
Trait Implementations§
Source§impl Clone for BayesianNetwork
impl Clone for BayesianNetwork
Source§fn clone(&self) -> BayesianNetwork
fn clone(&self) -> BayesianNetwork
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BayesianNetwork
impl Debug for BayesianNetwork
Auto Trait Implementations§
impl Freeze for BayesianNetwork
impl RefUnwindSafe for BayesianNetwork
impl Send for BayesianNetwork
impl Sync for BayesianNetwork
impl Unpin for BayesianNetwork
impl UnsafeUnpin for BayesianNetwork
impl UnwindSafe for BayesianNetwork
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.