Entropy 2025, 27, 62 11 of 33
Θ is then described by a Dirichlet distribution parametrised by a set of concentration
parameters θ:
p(Θ) =Dir(Θ|θ) (19)
The concentration parameter of a Dirichlet distribution is essentially a non-negative count
of how many times the given category (be it a type of observation or state transition) has
occurred. The distribution of concentration parameter counts will determine the shape
of the estimated categorical probability distribution, while the scale of the concentration
parameters will determine the certainty per precision of the belief. Updating beliefs about
Θ (the parameters in the matrices) then corresponds to updating these concentration
parameters θ with the following update equation:
θt+1 = ω ∗ θt + η ∗ χt (20)
The updated value for the concentration parameter (θt+1) is found by adding the previous
concentration parameter θt multiplied by a forgetting rate ω to the observed data count
χ (either the observation in the case of A learning, or the inferred state or state transition
for other matrices) multiplied by a learning rate η. With this relatively simple update
equation—which, in essence, amounts to just counting the occurrences of categories—an
AIF agent can update its beliefs about the various matrices it uses to make inferences about
environmental states. For more details on parameter learning with POMDPs, see [23,33,52].
3. Using ActiveInference.jl
In this section, we provide an overview of the various functions a user will need to
operate ActiveInference. This includes functionalities for creating POMDP agents, for sim-
ulating behaviour and for fitting the models to data. In the next section, we demonstrate
how to use the package on a concrete worked example.ActiveInference is under continual
development, and the newest version of the package, including documentation for how to
use it, can be found at github.com/ilabcode/ActiveInference.jl.
3.1. Creating and Using a POMDP
The general structure of ActiveInference.jl is heavily inspired by pymdp [23],
a Python library for implementing simulations of AIF in discrete state spaces. Those
already acquainted with pymdp should find the syntax here familiar. ActiveInference
can be installed as normal from the official Julia General Registry using the Julia’s native
package manager Pkg:
 
using Pkg
Pkg . add ( ActiveInference )
 
It can then be loaded into the current project environment:
 
using ActiveInference
 
Central to the package is the AIF object. This is a structure containing all the components of
the generative model, as well as the dynamic belief states and the various settings needed to
perform AIF, and is used in conjunction with most of the high-level functions of the package.
An AIF object can be created with the init_aif function, which takes as arguments the
components of the generative model and a dictionary of various settings and parameters: