Joint posterior for an SDS graphical model #
Given an SDS.GraphicalModel m, an n-node sentence with roles
roles : Fin n → Role, and observations obs : Fin n → Finset Concept
(the admissible concept sets at each node), this file provides:
partitionFunction m roles obs— the normalizing constantZ = ∑_{(s, c)} jointFactorObs m roles obs s cjointPosterior m roles obs h— the joint posterior PMF over(scenarioAssign, conceptAssign)consistent with observations, defined whenZ ≠ 0(at least one consistent assignment has nonzero unnormalized factor)conceptPosteriorAt m roles obs target h c— the marginal posterior probability that the target concept-node has valuec, integrating over all other nodes' scenario+concept assignments
Closed form #
By the SDS generative process, the joint factor at a configuration is product-form:
factor(s, c | roles, obs) =
[c is consistent with obs] · seqProb_α(counts(s)) ·
∏_i perScenario(s_i, c_i) · ∏_i selectional(roles_i, c_i)
The joint posterior normalizes this over all consistent configurations. The marginal at a target node is the natural sum:
P(c_target = c | obs) ∝
∑_{s, c' with c'_target = c, c' consistent with obs} factor(s, c' | roles, obs)
This is closed-form computable for finite Scenario, Concept, n. Phase 3 will instantiate it for the bat-in-player and astronomer-married-star sentences and compute the Table-1/Table-2 numbers as concrete corollaries.
Honest scope #
The closed form sums over Scenario^n × Concept^n, which is
exponential in n. For the small n in paper Tables 1–2 (3-4 nodes),
this is tractable. For longer sentences, mathlib's tsum/Finset.sum
machinery handles the abstraction; concrete computation would need
either MCMC (out of scope) or aggressive structural simplification.
The partition function: total unnormalized mass over all configurations consistent with observations.
Equations
- m.partitionFunction roles obs = ∑ sAssign : Fin n → Scenario, ∑ cAssign : Fin n → Concept, m.jointFactorObs roles obs sAssign cAssign
Instances For
The joint posterior over (scenarioAssign, conceptAssign) consistent
with observations, normalized by the partition function. Well-defined
when partitionFunction m roles obs ≠ 0.
Equations
- m.jointPosterior roles obs sAssign cAssign = m.jointFactorObs roles obs sAssign cAssign / m.partitionFunction roles obs
Instances For
The marginal posterior at a target concept-node: the probability
that the target node has value c, integrating over all other nodes'
scenario and concept assignments.
Equations
- m.conceptPosteriorAt roles obs target c = ∑ sAssign : Fin n → Scenario, ∑ cAssign : Fin n → Concept, if cAssign target = c then m.jointPosterior roles obs sAssign cAssign else 0
Instances For
The marginal at a target node, broken into the sum-of-numerator over the partition function. The natural form for explicit computation.
Enumerated-support partition function: when an explicit Finset
contains all configurations with non-zero jointFactorObs, the
partition function equals the sum over that Finset. The discharge
primitive that lets paper-replication study files skip the
8 ⋅ |Concept|^n direct enumeration.
Enumerated-support marginal posterior: the analogous discharge
primitive for conceptPosteriorAt. The numerator and denominator both
reduce to sums over the explicit support.