Reduction & Structural Reliability Problem
An Enhanced Bayesian Network (eBN) mixes discrete, continuous, and functional nodes, so it cannot be queried directly. reduce turns it into an inference-ready discrete network, a Bayesian Network (BN) when everything stays precise, or a Credal Network (CN) when any imprecision is present. This is the central operation of the library: it is the route by the Structural Reliability Methods selected to solve the Structural Reliability Problems (SRPs) that defines the Conditional Probability Tables (CPTs) of each functional node of the network.
The reduction pipeline
reduce follows the enhanced Bayesian Network (eBN) procedure of [1], and rests on the node-removal operations for evaluating influence diagrams [9]:
Build and Order the network (
order!, see Building and validating a network).Discretize every continuous node that carries a discretization structure it is replaced by a discrete node (the per-interval probability masses) plus a residual continuous node, with parents rewired to the discrete part and children to the continuous part (
discretize!, see Discretization).Transfer the model of each continuous functional node without discretization, into its children (
_transfer_continuous_functional_node!).
This is a computational optimization of the evaluation stage. A continuous-functional node that merely feeds another functional node would otherwise be evaluated on its own, sampling its models and fitting an EmpiricalDistribution per scenario, only for that distribution to be re-sampled by the child and then thrown away when the node is eliminated. Instead, its models are prepended to the child's model chain, so the samples already drawn are propagated straight through the child during the child's single Structural Reliability Problem evaluation. The intermediate empirical distribution is never built for a node that reduction removes anyway.
Evaluate functional nodes in dependency order. A node whose parents are all non-functional has ready inputs: its conditional table is filled by solving a Structural Reliability Problem over the scenario grid of its
discrete_ancestors. The functional node is then replaced by a node with defined CPT, whose kind and precision mirror what was evaluated (see Precise and imprecise outcomes below).Eliminate continuous parents. A continuous node that fed only the just-evaluated node is removed, and its parents reconnected to its children (
_eliminate_node!: node removal [9]); one that still feeds other functional nodes keeps its remaining edges, and only the spent edge is cut.Dispatch to the concrete type: once no node is continuous, an all-precise network becomes a BN and a network with any surviving imprecision a CN.
Progress bar
Step 4 is the expensive part — one Structural Reliability Problem per scenario. reduce takes a progress keyword that shows a progress bar over each functional node's scenario grid as it is evaluated. It defaults to isinteractive() (shown in the REPL, silent in scripts, tests, and this documentation); pass progress = true or progress = false to force it.
Structural Reliability Problems
The heart of step 4 is the structural reliability problem (SRP). Each functional node's parents' uncertainty or imprecision are propagated through its models. For a discrete-functional node, the node's performance function splits the outcome into a failed region (performance < 0) and a safe one, whose probability estimate becomes the node's conditional table. Thesimulation attached to the node decides how that probability is estimated.
Precise inputs
When every input is precise, the SRP is solved with a single-loop Structural Reliability Method, such as MonteCarlo, FORM, or advanced Monte Carlo methods (SubSetSimulation, LineSampling, and the like). Each scenario yields a single failure probability, so the reduced node is precise and a BN is returned.
using EnhancedBayesianNetworks
Load = DiscreteNode(:Load, [:low => [Parameter(1.0, :Load)], :high => [Parameter(3.0, :Load)]])
Load[:Load => :low] = 0.7; Load[:Load => :high] = 0.3
R = ContinuousNode(:R, Normal(3.0, 0.5)) # precise resistance
model = Model(df -> df.R .- df.Load, :g) # limit state g = R - Load
F = DiscreteFunctionalNode(:F, [model], df -> df.g, MonteCarlo(2000))
ebn = EnhancedBayesianNetwork([Load, R, F])
add_child!(ebn, :Load, :F)
add_child!(ebn, :R, :F)
order!(ebn)
ebnEnhancedBayesianNetwork
Nodes: 3
Edges: 2
Discrete nodes: 2
Continuous nodes: 1
Functional nodes: 1
Topology:
Node Type Precision Parents
--------------------------------------------------------------------------------
Load Discrete Precise -
R Continuous Precise -
F DiscreteFunctional Load, Rreduced = reduce(ebn) # -> BayesianNetworkBayesianNetwork
Nodes: 2
Edges: 1
Topology:
# Node States Parents
--------------------------------------------------------------------------------
1 Load low, high -
2 F F_failed, F_safe LoadImprecise inputs
When an input is imprecise: a continuous parent given as an Interval or ProbabilityBox. Then the failure probability is no longer a single number but a probability interval [2]. It is estimated by a double-loop structural reliability method — DoubleLoop, or RandomSlicing. Each scenario then produces a lower and an upper failure probability, the reduced node carries interval CPT entries, and reduce returns a CredalNetwork.
Only the type of the input and the simulation change — the network is built exactly as before:
Load = DiscreteNode(:Load, [:low => [Parameter(1.0, :Load)], :high => [Parameter(3.0, :Load)]])
Load[:Load => :low] = 0.7
Load[:Load => :high] = 0.3
R = ContinuousNode(:R, Interval(2.0, 4.0)) # imprecise resistance
model = Model(df -> df.R .- df.Load, :g)
F = DiscreteFunctionalNode(:F, [model], df -> df.g, DoubleLoop(MonteCarlo(1000)))
ebn = EnhancedBayesianNetwork([Load, R, F])
add_child!(ebn, :Load, :F)
add_child!(ebn, :R, :F)
order!(ebn)
ebnEnhancedBayesianNetwork
Nodes: 3
Edges: 2
Discrete nodes: 2
Continuous nodes: 1
Functional nodes: 1
Topology:
Node Type Precision Parents
--------------------------------------------------------------------------------
Load Discrete Precise -
R Continuous Imprecise -
F DiscreteFunctional Load, Rreduced = reduce(ebn) # -> CredalNetworkCredalNetwork
Nodes: 2
Edges: 1
Precise nodes: 1
Credal nodes: 1
Topology:
# Node Precision Parents
--------------------------------------------------------------------------------
1 Load Precise -
2 F Credal LoadThe imprecision then flows straight into inference: querying the reduced credal network returns a CN with lower and upper bounds (see the Inference chapter).
Precise and imprecise outcomes
The kind and precision of the node produced in step 4 mirrors the functional node it replaces:
a
DiscreteFunctionalNodebecomes a discrete node. Each scenario contributes a failure probability and its complement. In the precise case these are real numbers, so the reduced node has a real-valued CPT, and it is precise; in the imprecise case the failure probability comes out as a probability interval, so the CPT carries at least one interval entry and the node is imprecise.a
ContinuousFunctionalNodebecomes a continuous node whose distribution is refit from the drawn samples.
In the precise case each scenario yields a single empirical distribution; in the imprecise case each scenario yields two, a lower-bound and an upper-bound empirical distribution that bracket the family of admissible distributions. Consolidating this lower/upper pair into a single p-box per scenario is ongoing work.