зеркало из
https://github.com/docxology/cognitive.git
synced 2025-10-30 04:36:05 +02:00
2.8 KiB
2.8 KiB
Generalized Coordinates in Active Inference
Overview
Generalized coordinates are a fundamental concept in continuous-time active inference that allows for a richer representation of dynamical systems by explicitly incorporating higher-order temporal derivatives into the state space.
Mathematical Foundation
Basic Definition
A state x in generalized coordinates is represented as a vector of temporal derivatives:
x̃ = [x, x', x'', ..., x^(n)]
where:
- x is the state value
- x' is the first temporal derivative (velocity)
- x'' is the second temporal derivative (acceleration)
- etc.
Shift Operator
The shift operator D maps between orders of motion:
D[x, x', x''] = [x', x'', 0]
With factorial scaling for Taylor series:
D[x, x', x''] = [1!x', 2!x'', 0]
Role in Active Inference
1. Belief Representation
Beliefs about states are represented in generalized coordinates:
q(x̃) = N(μ̃, Σ̃)
where:
- μ̃ is the vector of means across orders
- Σ̃ is the precision (inverse covariance) matrix
2. Dynamics
The generalized motion of states follows:
dx̃/dt = Dx̃ - ∂F/∂x̃
where:
- D is the shift operator
- F is the variational free energy
- ∂F/∂x̃ are the gradients in generalized coordinates
3. Prediction
Predictions in generalized coordinates allow for:
- Smooth trajectories
- Velocity matching
- Acceleration matching
- Higher-order consistency
Implementation Details
1. State Representation
class ContinuousState:
belief_means: np.ndarray # Shape: [n_states, n_orders]
belief_precisions: np.ndarray # Shape: [n_states, n_orders]
2. Shift Operator
def create_shift_operator(n_orders):
D = np.zeros((n_orders, n_orders))
for i in range(n_orders - 1):
D[i, i+1] = factorial(i+1) / factorial(i)
return D
3. Free Energy
The free energy includes terms for all orders:
F = Σᵢ (prediction_errorᵢ)²/2σᵢ²
where i runs over all orders of motion.
Advantages
- Smooth Dynamics: Natural handling of continuous trajectories
- Rich Predictions: Incorporation of velocity and acceleration
- Temporal Consistency: Enforced across multiple orders
- Uncertainty Propagation: Through all orders of motion
Visualization
- State Space: Plot of position vs. velocity
- Generalized Coordinates: Multiple plots for each order
- Prediction Errors: Across all orders of motion
- Taylor Expansions: Showing predictive power
References
- Friston, K. J., et al. (2008). DEM: A variational treatment of dynamic systems.
- Buckley, C. L., et al. (2017). The free energy principle for action and perception: A mathematical review.
- Baltieri, M., & Buckley, C. L. (2019). Generalized synchronization through learning in coupled dynamical systems.