pub struct BayesianNetwork {
pub nodes: [BayesianNode; 32],
pub num_nodes: usize,
}Fields§
§nodes: [BayesianNode; 32]§num_nodes: usizeImplementations§
Source§impl BayesianNetwork
impl BayesianNetwork
pub fn new() -> Self
pub fn add_node(&mut self, node: BayesianNode) -> Result<(), &'static str>
Sourcepub fn extract_weight(quin: &NQuin) -> f32
pub fn extract_weight(quin: &NQuin) -> f32
Extract probability encoded in the Quin’s metadata field (canonical truth-degree via the FrameLayout ABI — shared with fuzzy/stochastic).
Sourcepub fn update_beliefs(&self, target_id: u64) -> Option<f32>
pub fn update_beliefs(&self, target_id: u64) -> Option<f32>
Exact inference via variable enumeration. Fully zero-allocation, iteratively evaluates joint probability table on the stack. Max unobserved variables allowed is 16 to prevent excessive CPU loop blocking (O(2^N)).
Sourcepub fn markov_blanket(&self, node_id: u64, out: &mut [u64]) -> usize
pub fn markov_blanket(&self, node_id: u64, out: &mut [u64]) -> usize
The Markov blanket of node_id: its parents, its children, and its children’s OTHER
parents (co-parents). Conditioned on its blanket a node is independent of all others —
the locality used for rapid conditional-independence testing and Gibbs sampling. Writes the
member ids into out, returns the count. Zero-heap.
Sourcepub fn gibbs_estimate(
&self,
target_id: u64,
samples: u32,
seed: u64,
) -> Option<f32>
pub fn gibbs_estimate( &self, target_id: u64, samples: u32, seed: u64, ) -> Option<f32>
Gibbs sampling (MCMC) estimate of P(target = true | evidence) — approximate inference
for networks too large for exact enumeration. samples sweeps, seed for the PRNG. Each
non-evidence variable is resampled from its Markov-blanket conditional. Zero-heap (bounded
stack arrays). None if target_id is not in the network.
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§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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