GradientResult#

class hybrid_aif.planning.GradientResult[source]#

Bases: NamedTuple

One gradient plan. With several starts, plan is the best start’s and trace, gradient_trace and best_step are its own.

q_pi: Categorical#

The point mass on pick, (starts,).

tree: dict[str, dict[str, Interval]] | None#

The term tree of plan (the picked start’s slice of start_tree).

plan: Array#

The best plan scored over the descent (the warm start and the final plan included), (policy_len, action_dim): the best start’s.

G: Interval#

The expected free energy of plan, (1,) (the picked start’s slice of start_G).

start_plans: Array#

Every start’s plan, (starts, policy_len, action_dim).

pick: Array#

The int32 index of plan among start_plans.

start_G: Interval#

The expected free energy over start_plans (a policy axis of starts entries), (starts,).

start_tree: dict[str, dict[str, Interval]] | None#

The term tree over start_plans (None under metrics=False).

posterior: TruncatedGaussian | None#

The restriction of curvature to the box (None under posterior="mode").

curvature: Gaussian | None#

The Laplace Gaussian N(plan, (γ∇²G)⁻¹) over the flattened plan, taken at plan (None under posterior="mode").

trace: Array#

The scored G before each step.

gradient_trace: Array#

The root mean square of the gradient over all plan coordinates before each step, (steps,).

best_step: Array#

The int32 index of the plan returned: t for the plan held before step t (0 is the warm start) and steps for the final plan.

start_scores: Array#

Each start’s final score (the descended point of G), (starts,); (1,) for one start.

static __new__(
_cls,
q_pi,
tree,
plan,
G,
start_plans,
pick,
start_G,
start_tree,
posterior,
curvature,
trace,
gradient_trace,
best_step,
start_scores,
)#

Create new instance of GradientResult(q_pi, tree, plan, G, start_plans, pick, start_G, start_tree, posterior, curvature, trace, gradient_trace, best_step, start_scores)