pub struct BayesianConfig {
pub name: String,
pub nodes: HashMap<String, BayesianNode>,
}Expand description
Configuration for Bayesian network
Fields§
§name: StringNetwork name
nodes: HashMap<String, BayesianNode>Nodes by name
Implementations§
Source§impl BayesianConfig
impl BayesianConfig
Sourcepub fn with_node(self, name: &str, node: BayesianNode) -> Self
pub fn with_node(self, name: &str, node: BayesianNode) -> Self
Add a node
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Validate the configuration
§Errors
Returns an error if the network is empty, any node is invalid, parent references are missing, or the graph contains cycles.
Sourcepub fn topological_order(&self) -> Vec<String>
pub fn topological_order(&self) -> Vec<String>
Get topological order of nodes
Sourcepub fn root_nodes(&self) -> Vec<&str>
pub fn root_nodes(&self) -> Vec<&str>
Get root nodes
Trait Implementations§
Source§impl Clone for BayesianConfig
impl Clone for BayesianConfig
Source§fn clone(&self) -> BayesianConfig
fn clone(&self) -> BayesianConfig
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 BayesianConfig
impl Debug for BayesianConfig
Source§impl Default for BayesianConfig
impl Default for BayesianConfig
Source§fn default() -> BayesianConfig
fn default() -> BayesianConfig
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for BayesianConfig
impl<'de> Deserialize<'de> for BayesianConfig
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
Auto Trait Implementations§
impl Freeze for BayesianConfig
impl RefUnwindSafe for BayesianConfig
impl Send for BayesianConfig
impl Sync for BayesianConfig
impl Unpin for BayesianConfig
impl UnsafeUnpin for BayesianConfig
impl UnwindSafe for BayesianConfig
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