Skip to content

About

Julia project connecting Active Inference with RxInfer.jl: a package entry point plus a verified Beta-Bernoulli message-passing example, from the Active Inference Institute.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

4 watching

Forks

Repository files navigation

ActInf_RxInfer

Active Inference and RxInfer.jl.

CI License: MIT Julia: 1.10+

Contents

Status

This repository provides a Julia project environment for work connecting Active Inference with RxInfer.jl, the Beta-Bernoulli coin-flip model as a Generalized Notation Notation (GNN) document, a package entry point that reads that document, a runnable example, and a test suite. The dependency environment is declared in Project.toml. run.sh is the gate entry point, and CI runs its arms: ./run.sh full on the long-term support release and on stable, ./run.sh lint and ./run.sh docs in one static job, and ./run.sh gnn as a required conformance job.

Generative-model specification

The model is declared in specs/coin_flip.gnn.md: latent bias theta ~ Beta(a, b), observations y_i ~ Bernoulli(theta), the sufficient statistic k = sum(y), and the closed-form conjugate posterior theta | y ~ Beta(a + k, b + n - k). The Julia code reads the declared prior, observation count, and seed instead of repeating them: spec_parameters(SPEC_PATH) loads them through the dependency-free reader src/spec_reader.jl.

specs/gnn-pin.json retains GNN v5.4.0 at commit e2bba8ae2 and its parser digests. The independently checked standalone producer reads that pin before any GNN import. scripts/validate_gnn_spec.py checks the model with the admitted parser and Julia reader; the producer's shared checker then validates the pin, .github/GNN.md and document. ./run.sh gnn owns both steps. See docs/reference/gnn.md for required resources, admission modes and proof limits.

GNN maintains a downstream adoption guide for repositories that consume the notation.

Getting started

Install Julia 1.10 or later, clone the repository, and activate the project from its root:

using Pkg
Pkg.activate(".")
Pkg.instantiate()
Pkg.status()

The same commands can be run non-interactively:

julia --project=. -e 'using Pkg; Pkg.instantiate(); Pkg.status()'

See docs/guides/getting_started.md for the environment workflow and docs/index.md for the documentation map.

Example

A verified Beta-Bernoulli "coin flip" example (examples/coin_flip.jl) estimates the bias of a coin by message-passing inference and compares the result with the conjugate posterior:

julia --project=. examples/coin_flip.jl

Verified output (Julia 1.13.3, RxInfer 6.1.1, ReactiveMP 7.0.1, fixed random seed; the first line prints the absolute path of the document):

Specification:    <repository>/specs/coin_flip.gnn.md
True bias:        0.75
Observations:     500 (371 successes)
Inferred mean:    0.7400793650793651
Inferred std:     0.01951703487781785
95% CI:           [0.7009483694712986, 0.7774057699488053]
Conjugate mean:   0.7400793650793651
Conjugate std:    0.01951703487781785

Tests

run.sh is the single gate entry point; each arm runs one command and CI calls the same script. docs/guides/gate.md describes every arm, and docs/_generated/gate.md records the measured wall time of each one.

./run.sh             # lint, then the fast arm
./run.sh full        # every testset, through Pkg.test()
./run.sh gnn         # the pinned GNN conformance check

The fast arm runs the suite without the two testsets that start RxInfer message passing. The full arm explicitly sets ACTINF_RXINFER_TEST_ARM=full before Pkg.test(), overriding an inherited fast setting. The suite reads the committed GNN document and checks the declared model, reader errors, reproducible data generation, and agreement between message passing and the conjugate posterior.

Follow the GNN conformance guide to obtain the verified release files, select a runtime, and read the gate result.

Dependencies

The project declares RxInfer.jl 6, ReactiveMP.jl 7, and supporting Julia packages for probability distributions and statistics. Version bounds are recorded in Project.toml; the repository does not pin a committed Manifest.toml. Plots and FileIO are no longer declared: nothing in the package, examples, or tests used them, and their native dependencies (Qt, FFMPEG, GR) do not resolve on every host. Add them to your environment with Pkg.add("Plots") if you want them.

Resources

Contributing

Read CONTRIBUTING.md before opening a change. Security reports are described in SECURITY.md. Citation metadata is available in CITATION.cff.

License

This project is released under the MIT License. Copyright © 2024 Active Inference Institute.

InstituteOS sidecar

This repository carries a committed .aii/ sidecar with curated InstituteOS metadata (aii-sidecar/v1): category, maturity, ecosystem relations, key artifacts, provenance, and portable tasks. It is read by InstituteOS tooling and does not affect the project's build or runtime.

About

Julia project connecting Active Inference with RxInfer.jl: a package entry point plus a verified Beta-Bernoulli message-passing example, from the Active Inference Institute.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages