FPI (Fixed Point Iteration)

pymdp.algos.fpi.run_vanilla_fpi(A, obs, num_obs, num_states, prior=None, num_iter=10, dF=1.0, dF_tol=0.001)

Update marginal posterior beliefs over hidden states using mean-field variational inference, via fixed point iteration.

  • A (numpy.ndarray of dtype object) – Sensory likelihood mapping or ‘observation model’, mapping from hidden states to observations. Each element A[m] of stores an np.ndarray multidimensional array for observation modality m, whose entries A[m][i, j, k, ...] store the probability of observation level i given hidden state levels j, k, ...

  • obs (numpy 1D array or numpy ndarray of dtype object) – The observation (generated by the environment). If single modality, this should be a 1D np.ndarray (one-hot vector representation). If multi-modality, this should be np.ndarray of dtype object whose entries are 1D one-hot vectors.

  • num_obs (list of ints) – List of dimensionalities of each observation modality

  • num_states (list of ints) – List of dimensionalities of each observation modality

  • prior (numpy ndarray of dtype object, default None) – Prior over hidden states. If absent, prior is set to be the log uniform distribution over hidden states (identical to the initialisation of the posterior)

  • num_iter (int, default 10) – Number of variational fixed-point iterations to run until convergence.

  • dF (float, default 1.0) – Initial free energy gradient (dF/dt) before updating in the course of gradient descent.

  • dF_tol (float, default 0.001) – Threshold value of the time derivative of the variational free energy (dF/dt), to be checked at each iteration. If dF <= dF_tol, the iterations are halted pre-emptively and the final marginal posterior belief(s) is(are) returned


qs – Marginal posterior beliefs over hidden states at current timepoint

Return type

numpy 1D array, numpy ndarray of dtype object, optional