Statistics & probability

Discrete Bayesian network inference calculator from conditional tables

Condition a supplied binary Bayesian network on evidence and compute posterior marginals by complete bounded enumeration.

Your numbers

Enter a finite value within the stated calculator bounds.
One row per variable 0…n−1; list parents in desired order or none for a root.
One row per variable: P(variable=1)for every binary parent state in lexicographic order; first parent is most significant bit.
One variable, state 0/1 pair per row, or none.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Condition a supplied binary Bayesian network on evidence and compute posterior marginals by complete bounded enumeration.

THE FORMULAP(x)=Πi P(xi|parentsi); P(query|evidence)=Σcompatiblejoint / P(evidence).

A worked example

For the three-variable default and evidence variable 2=1, the evidence probability is 0.3053 and the posterior probabilities of variables 0 and 1 are approximately 0.8647232 and 0.8614478.

Good to know

1–8 binary variables, acyclic supplied parent lists, complete normalized CPTs and noncontradictory binary evidence. At most 256 assignments enumerated. Parent ordering is significant. No structure or parameter learning, continuous variables or automatic causal intervention.

A graph and local probabilities define a model

A Bayesian network combines a directed acyclic graph with conditional probability tables. The graph specifies which variables enter each local conditional distribution. Multiplying those local terms produces a full joint distribution over all binary assignments, even when no explicit joint table is entered.

This page performs inference in that supplied model. It does not discover the graph from data or estimate its probability tables. A neat posterior result can still be misleading if the conditional-independence assumptions or local probabilities do not represent the intended application.

Conditioning a three-variable network012Evidence: 2 = 1P(evidence) = 0.30534 compatible states
Scroll across to see the full diagram.
The default DAG has 0→1,0→2 and 1→2; variable 2 is observed in state 1.

Compare this with the Continuous time Markov chain calculator from a rate matrix. Condition a static probabilistic DAG on evidence and compute posterior marginals, rather than propagate a time-indexed transition chain.

Reading the parent and probability rows

Variable indices start at zero, and there is one parent row per variable. Use none for a root variable. A variable cannot parent itself, parent lists cannot repeat an index, and the resulting directed graph must be acyclic even when its entered rows are not already in topological order.

Each probability row supplies the chance that its variable equals one for every parent-state combination. A binary variable with two parents needs four values. The first listed parent is the most significant state bit, so changing parent order without permuting the table entries changes the model.

The three-variable evidence example

In the default network, variable zero is a root, variable one depends on zero, and variable two depends on both zero and one. Evidence sets variable two to one. Four assignments of the remaining two variables remain compatible and receive weights from the corresponding local table products.

Those unnormalized weights sum to zero-point-three-zero-five-three, the evidence probability. Dividing each compatible weight by that sum produces a posterior joint distribution. Summing its appropriate rows yields the displayed marginal probability that each variable equals one; the observed variable's marginal is exactly one under the evidence.

Enumerating without an approximation sample

With at most eight binary variables there are no more than two-hundred-fifty-six full assignments. The calculator evaluates every assignment compatible with the evidence, multiplies its local conditional factors and accumulates the resulting evidence and marginal masses. No random samples or Monte Carlo error are introduced.

Exact enumeration here means the finite assignment set is complete; probability arithmetic still uses floating numbers. Evidence with zero or numerically negligible probability is rejected because conditioning would require division by an undefined or unresolved mass. It is not converted into a uniform posterior as a fallback.

Observing is not intervening

Conditioning on a variable's observed value retains the probability model that generated it. A causal intervention changes the model's generating mechanism by fixing a variable and removing its incoming influence. Those operations can produce different distributions even when they use the same visible value.

The evidence field only conditions. It does not claim that directed arrows have a causal interpretation, and it does not implement an intervention by silently deleting parents. A scientific causal question requires additional assumptions and an explicitly modified network rather than a change of wording around an observational posterior.

Checking tables and posterior support

All entered probabilities must lie between zero and one. Because the interface stores only the probability of state one, state zero is its complement, ensuring each local binary distribution sums to one. The number of entries must exactly match the listed parent count.

The returned joint posterior shows how evidence redistributes mass among compatible assignments. Zero-probability states remain possible structural entries with zero weight rather than being treated as observations. Verify that posterior weights sum to one and every evidence variable is fixed at the supplied state before interpreting a query marginal.

Independent checks and practical limits

For a small network, hand-enumerate a few state products and compare them with the returned table. With no evidence, the evidence probability should be one. Reordering variable labels consistently across the graph, tables and evidence should preserve corresponding probabilities, while changing only one label changes the model.

Large networks require more efficient inference methods, and incomplete or uncertain tables require an estimation model. This page intentionally stays within a small fully specified binary setting. It makes conditioning transparent without pretending that a model entered in a form has been empirically validated or learned from its illustrative defaults.

A few questions, answered

Does it learn the graph?

No. You supply the directed acyclic graph and all conditional probability values.

What is the parent-state order?

Binary lexicographic order with the first listed parent as the most significant bit.

Is enumeration exact?

All finite assignments are considered, although their probabilities use floating arithmetic rather than symbolic rationals.

Does evidence perform a causal intervention?

No. Evidence conditions the existing distribution; an intervention would change the generating model.

Find your calculator

Start typing to explore the library.