BN

Trait BN 

Source
pub trait BN {
    type CPD;
    type Evidence;
    type Sample;
    type Samples;

    // Required methods
    fn new<I>(graph: DiGraph, cpds: I) -> Self
       where I: IntoIterator<Item = Self::CPD>;
    fn name(&self) -> Option<&str>;
    fn description(&self) -> Option<&str>;
    fn graph(&self) -> &DiGraph;
    fn cpds(&self) -> &Map<String, Self::CPD>;
    fn parameters_size(&self) -> usize;
    fn topological_order(&self) -> &[usize];
    fn with_optionals<I>(
        name: Option<String>,
        description: Option<String>,
        graph: DiGraph,
        cpds: I,
    ) -> Self
       where I: IntoIterator<Item = Self::CPD>;
}
Expand description

A trait for Bayesian networks.

Required Associated Types§

Source

type CPD

The type of the CPD.

Source

type Evidence

The type of the evidence.

Source

type Sample

The type of the sample.

Source

type Samples

The type of the samples.

Required Methods§

Source

fn new<I>(graph: DiGraph, cpds: I) -> Self
where I: IntoIterator<Item = Self::CPD>,

Constructs a new Bayesian network.

§Arguments
  • graph - The underlying graph.
  • cpds - The conditional probability distributions.
§Returns

A new Bayesian network instance.

Source

fn name(&self) -> Option<&str>

Returns the name of the model, if any.

§Returns

The name of the model, if it exists.

Source

fn description(&self) -> Option<&str>

Returns the description of the model, if any.

§Returns

The description of the model, if it exists.

Source

fn graph(&self) -> &DiGraph

Returns the underlying graph.

§Returns

A reference to the graph.

Source

fn cpds(&self) -> &Map<String, Self::CPD>

Returns the a map labels-distributions.

§Returns

A reference to the cpds.

Source

fn parameters_size(&self) -> usize

Returns the parameters size.

§Returns

The parameters size.

Source

fn topological_order(&self) -> &[usize]

Returns the topological order of the graph.

§Returns

A reference to the topological order.

Source

fn with_optionals<I>( name: Option<String>, description: Option<String>, graph: DiGraph, cpds: I, ) -> Self
where I: IntoIterator<Item = Self::CPD>,

Creates a new Bayesian network with optional fields.

§Arguments
  • name - The name of the model.
  • description - The description of the model.
  • graph - The underlying graph.
  • cpds - The conditional probability distributions.
§Panics
  • Panics if name is an empty string.
  • Panics if description is an empty string.
§Returns

A new Bayesian network instance.

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§