https://github.com/computationalpsychiatry/activeinference.jl
A Julia Package for Active Inference
https://github.com/computationalpsychiatry/activeinference.jl
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: sciencedirect.com -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.3%) to scientific vocabulary
Repository
A Julia Package for Active Inference
Basic Info
Statistics
- Stars: 34
- Watchers: 2
- Forks: 4
- Open Issues: 2
- Releases: 8
Metadata Files
README.md
ActiveInference.jl
ActiveInference.jl is a new Julia package for the computational modeling of active inference. We provide the necessary infrastructure for defining active inference models, currently implemented as partially observable Markov decision processes. After defining the generative model, you can simulate actions using agent-based simulations. We also provide the functionality to fit experimental data to active inference models for parameter recovery.
* Example visualization of an agent navigating a maze, inspired by the one described in Bruineberg et al., 2018.
Left: A synthetic agent wants to reach the end of the maze environment while avoiding dark-colored locations.
Right: The agent's noisy prior expectations about the state of the environment parameterized by Dirichlet distributions are updated dynamically as it moves through the maze.
News
Version 0.1.1 - December 2024
- Initial release of the package documentation.
Installation
Install ActiveInference.jl using the Julia package manager: ````@example Introduction using Pkg Pkg.add("ActiveInference")
using ActiveInference ````
Getting Started
Understanding Vector Data Types in ActiveInference.jl
The generative model is defined using vectors of arrays, where each element can itself be a multi-dimensional array or matrix. For example:
- If there is only one modality ````@example Introduction
Initialize States, Observations, and Controls
states = [25] observations = [25] controls = [2] # Two controls (e.g. left and right) policy_length = 2
Generate random Generative Model
A, B = creatematrixtemplates(states, observations, controls, policy_length);
Here, the A_matrix is a one element Vector{Matrix{Float64}} where the element is a 25x25 Matrix
size(A[1])
````
- If there are more modalities ````@example Introduction
Initialize States, Observations, and Controls
states = [25,2] observations = [25,2] controls = [2,1] # Only the first factor is controllable (e.g. left and right) policy_length = 2
Generate random Generative Model
A, B = creatematrixtemplates(states, observations, controls, policy_length);
Each modality is stored as a separate element.
size(A[1]) # Array{Float64, 3} with these dimensions: (25, 25, 2) size(A[2]) # Array{Float64, 3} with these dimensions: (2, 25, 2)
```` More detailed description of Julia arrays can be found in the official Julia Documentation
Basic Usage
````@example Introduction
Define some settings as a dictionary.
settings = Dict( "policy_len" => 3)
Define some parameters as a dictionary.
parameters = Dict("alpha" => 16.0 )
Initialize the AIF-type agent.
aif = init_aif(A,
B;
settings = settings,
parameters = parameters);

@example Introduction
Give observation to the agent and run state inference.
observation = [3,1] infer_states!(aif, observation)
Infer policies
infer_policies!(aif)
Sample action
sample_action!(aif)
````
Owner
- Name: TAPAS
- Login: ComputationalPsychiatry
- Kind: organization
- Repositories: 1
- Profile: https://github.com/ComputationalPsychiatry
GitHub Events
Total
- Issues event: 1
- Watch event: 7
- Member event: 1
- Issue comment event: 1
- Push event: 54
- Pull request event: 4
- Fork event: 3
- Create event: 2
Last Year
- Issues event: 1
- Watch event: 7
- Member event: 1
- Issue comment event: 1
- Push event: 54
- Pull request event: 4
- Fork event: 3
- Create event: 2
Dependencies
- actions/checkout v4 composite
- codecov/codecov-action v3 composite
- julia-actions/cache v1 composite
- julia-actions/julia-buildpkg v1 composite
- julia-actions/julia-processcoverage v1 composite
- julia-actions/julia-runtest v1 composite
- julia-actions/julia-uploadcoveralls v1 composite
- julia-actions/setup-julia v1 composite
- JuliaRegistries/TagBot v1 composite