policy_posterior

policy_posterior#

hybrid_aif.planning.policy_posterior(G, gamma, policy_prior=None, use_bound='midpoint', legal=None)[source]#

Policy posterior q_pi ∝ softmax(-gamma * G + log E + log 1[legal]).

Each policy is scored by a point of the interval G: "midpoint" (default), "lower" (optimistic) or "upper" (pessimistic). policy_prior is E over the policy set, a log-space array or a Categorical. legal is legal_logits()’ output, added after log E and never touching G. The System faces apply the mask themselves, after the planner returns. The composition is pymdp’s control.update_posterior_policies (pymdp/control.py), in G’s natural sign; pymdp’s values are the parity oracle (tests/test_planning.py). pymdp’s composition is SPM’s prior over policies in spm_MDP_VB_X (spm_softmax(qE + w·Q)). The precision γ is fixed here, where SPM can also update it under a Gamma prior; E is not learned. Design: docs/design/action-legality.md L2