Skip to content

Commit

Permalink
Merge branch 'main' into make-formatting-a-separate-action
Browse files Browse the repository at this point in the history
  • Loading branch information
bvdmitri authored Oct 21, 2024
2 parents 1f6eae0 + 635a856 commit f737ac1
Show file tree
Hide file tree
Showing 41 changed files with 6,459 additions and 4,702 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
journal: joss
# This should be the path to the paper within your repo.
paper-path: paper/paper.md
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v4
with:
name: paper
# This is the output path where Pandoc will write the compiled
Expand All @@ -42,7 +42,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.10'
- '1.11'
os:
- ubuntu-latest
arch:
Expand All @@ -62,7 +62,7 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Archive test artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: test-output
path: test/_output
Expand Down
18 changes: 14 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "RxInfer"
uuid = "86711068-29c9-4ff7-b620-ae75d7495b3d"
authors = ["Bagaev Dmitry <d.v.bagaev@tue.nl> and contributors"]
version = "3.4.0"
version = "3.7.1"

[deps]
BayesBase = "b4ee3484-f114-42fe-b91c-797d54a0c67e"
Expand All @@ -19,24 +19,33 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
ReactiveMP = "a194aa59-28ba-4574-a09c-4a745416d6e3"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Rocket = "df971d30-c9d6-4b37-b8ff-e965b2cb3a40"
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
TupleTools = "9d95972d-f1c8-5527-a6e0-b4b365fa01f6"

[weakdeps]
ExponentialFamilyProjection = "17f509fa-9a96-44ba-99b2-1c5f01f0931b"

[extensions]
ProjectionExt = "ExponentialFamilyProjection"

[compat]
BayesBase = "1.1"
DataStructures = "0.18"
Distributions = "0.25"
DomainSets = "0.5.2, 0.6, 0.7"
ExponentialFamily = "1.2"
ExponentialFamily = "1.5"
ExponentialFamilyProjection = "1.1"
FastCholesky = "1.3.0"
GraphPPL = "~4.3.0"
LinearAlgebra = "1.9"
MacroTools = "0.5.6"
Optim = "1.0.0"
ProgressMeter = "1.0.0"
Random = "1.9"
ReactiveMP = "~4.2.0"
ReactiveMP = "~4.4.1"
Reexport = "1.2.0"
Rocket = "1.8.0"
Static = "0.8.10, 1"
TupleTools = "1.2.0"
julia = "1.10"

Expand All @@ -49,6 +58,7 @@ CpuId = "adafc99b-e345-5852-983c-f28acb93d879"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
ExponentialFamilyProjection = "17f509fa-9a96-44ba-99b2-1c5f01f0931b"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
Optimisers = "3bd65402-5787-11e9-1adc-39752487f4e2"
Expand All @@ -62,4 +72,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestSetExtensions = "98d24dd4-01ad-11ea-1b02-c9a08f80db04"

[targets]
test = ["Test", "Pkg", "Logging", "InteractiveUtils", "TestSetExtensions", "Coverage", "CpuId", "Dates", "Distributed", "Documenter", "Plots", "BenchmarkCI", "BenchmarkTools", "PkgBenchmark", "Aqua", "StableRNGs", "StatsFuns", "Optimisers", "ReTestItems"]
test = ["Test", "Pkg", "Logging", "InteractiveUtils", "TestSetExtensions", "Coverage", "CpuId", "Dates", "Distributed", "Documenter", "ExponentialFamilyProjection", "Plots", "BenchmarkCI", "BenchmarkTools", "PkgBenchmark", "Aqua", "StableRNGs", "StatsFuns", "Optimisers", "ReTestItems"]
55 changes: 39 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,40 +160,63 @@ result = infer(

![Coin Flip](docs/src/assets/img/coin-flip.svg?raw=true&sanitize=true "Coin-Flip readme results")

# Where to go next?
# Roadmap

There are a set of [examples](https://reactivebayes.github.io/RxInfer.jl/stable/examples/overview/) available in `RxInfer` repository that demonstrate the more advanced features of the package. Alternatively, you can head to the [documentation](https://reactivebayes.github.io/RxInfer.jl/stable/) that provides more detailed information of how to use `RxInfer` to specify more complex probabilistic models.
Our high-level project roadmap outlines the key milestones and focus areas for the upcoming years:

Additionally, checkout our [video from JuliaCon 2023](https://www.youtube.com/watch?v=qXrvDVm_fnE) for a high-level overview of the package
| Q1/Q2 2024 | Q3/Q4 2024 | 2025 |
|---------------------|---------------------------|--------------------|
| 🧩 **Nested models with [GraphPPL.jl](https://github.com/reactivebayes/GraphPPL.jl)**| 🌐 **Graph structure visualization** | 🔀 **Stochastic Processes** |
| 🔄 **Development of [ExponentialFamilyProjection.jl]()**| 🧠 **Automated inference with [ExponentialFamilyProjection.jl](https://github.com/reactivebayes/ExponentialFamilyProjection.jl)** | 🚀 **Robustness & Memory-efficiency** |

<p align="center">
<a href="https://www.youtube.com/watch?v=qXrvDVm_fnE"><img width="460" src="https://img.youtube.com/vi/qXrvDVm_fnE/0.jpg"></a>
</p>
For a more granular view of our progress and ongoing tasks, check out our [project board](https://github.com/orgs/reactivebayes/projects/2/views/4) or join our 4-weekly [public meetings](https://dynalist.io/d/F4aA-Z2c8X-M1iWTn9hY_ndN).

# Roadmap
# External Contributors

Our high-level project roadmap outlines the key milestones and focus areas for the upcoming years:
RxInfer has benefited from the contributions and development efforts of external collaborators and organizations. We're grateful for their involvement in advancing the project.

## Active Inference Institute

Members of the [Active Inference Institute](https://www.activeinference.org/) have been working on improving the visualization capabilities of RxInfer/GraphPPL. Their efforts focus on developing better model visualization capabilities, creating various summary/subgraph visualization modalities, implementing different graph layout algorithms, and improving the ability to inspect and understand models.

| Q1/Q2 2024 | Q3/Q4 2024 | 2025 | 2026 |
|---------------------|---------------------------|--------------------|-------------------------------------------|
| 🧩 **Nested models with [GraphPPL.jl](https://github.com/reactivebayes/GraphPPL.jl)** ✅ | 🛡️ **Robustness (NaN, Inf free)** | 🌐 **Stochastic Processes** | 🔄 **Automated inference with non-exponential family**
| 🔄 **Automated inference with [ExponentialFamily.jl](https://github.com/reactivebayes/ExponentialFamily.jl)** | 🧠 **Memory-efficiency** | 🚀 **Resource-adaptive inference** | 📊 **Inference over graph structure**
For more details on their ongoing work, see the [RxInfer development project board](https://coda.io/d/RxInfer-2024-Active-Inference-Institute_ddtS-XZ4BJb/Developing-RxInfer-jl_sufeCeIa#_lutfq_7F).

For a more granular view of our progress and ongoing tasks, check out our [project board](https://github.com/orgs/reactivebayes/projects/2/views/4) or join our
4-weekly [public meetings](https://dynalist.io/d/F4aA-Z2c8X-M1iWTn9hY_ndN).
## Educational Content

Educational content and tutorials related to RxInfer are being developed and can be found on [Learnable Loop](https://learnableloop.com/#category=RxInfer). These resources cover a range of topics including visualizing Forney Factor Graphs, sales forecasting with time-varying autoregressive models, hidden Markov models with control, and various applications of Active Inference across different domains.

# Contributing

We welcome contributions from the community. If you are interested in contributing to the development of `RxInfer.jl`, please check out our [contributing guide](https://reactivebayes.github.io/RxInfer.jl/stable/contributing/guide), the [contributing guidelines](https://reactivebayes.github.io/RxInfer.jl/stable/contributing/guidelines), or look at the [issues linked with the `good first issue` label](https://github.com/ReactiveBayes/RxInfer.jl/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) to get started.

# Ecosystem
# Where to go next?

The `RxInfer` framework consists of three *core* packages developed by reactivebayes:
There are a set of [examples](https://reactivebayes.github.io/RxInfer.jl/stable/examples/overview/) available in `RxInfer` repository that demonstrate the more advanced features of the package. Alternatively, you can head to the [documentation](https://reactivebayes.github.io/RxInfer.jl/stable/) that provides more detailed information of how to use `RxInfer` to specify more complex probabilistic models.

## Ecosystem

The `RxInfer` framework consists of three *core* packages developed by [ReactiveBayes](https://github.com/reactivebayes/):

- [`ReactiveMP.jl`](https://github.com/reactivebayes/ReactiveMP.jl) - the underlying message passing-based inference engine
- [`GraphPPL.jl`](https://github.com/reactivebayes/GraphPPL.jl) - model and constraints specification package
- [`Rocket.jl`](https://github.com/reactivebayes/Rocket.jl) - reactive extensions package for Julia

## JuliaCon 2023 presentation

Additionally, checkout our [video from JuliaCon 2023](https://www.youtube.com/watch?v=qXrvDVm_fnE) for a high-level overview of the package

<p align="center">
<a href="https://www.youtube.com/watch?v=qXrvDVm_fnE"><img style="width: 100%" src="https://img.youtube.com/vi/qXrvDVm_fnE/0.jpg"></a>
</p>

## Our presentation at the Julia User Group Munich meetup

Also check out the recorded presentation at the Julia User Group Munich meetup for a more detailed overview of the package

<p align="center">
<a href="https://www.youtube.com/watch?v=KuluqEzFtm8"><img style="width: 100%" src="https://img.youtube.com/vi/KuluqEzFtm8/0.jpg"></a>
</p>

# License

[MIT License](LICENSE) Copyright (c) 2021-2024 BIASlab, 2024-present ReactiveBayes
4 changes: 2 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"downloadUrl": "https://github.com/reactivebayes/RxInfer.jl/releases",
"issueTracker": "https://github.com/reactivebayes/RxInfer.jl/issues",
"name": "RxInfer.jl",
"version": "3.4.0",
"version": "3.7.1",
"description": "Julia package for automated, scalable and efficient Bayesian inference on factor graphs with reactive message passing. ",
"applicationCategory": "Statistics",
"developmentStatus": "active",
"readme": "https://reactivebayes.github.io/RxInfer.jl/stable/",
"softwareVersion": "3.4.0",
"softwareVersion": "3.7.1",
"keywords": [
"Bayesian inference",
"message passing",
Expand Down
3 changes: 3 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
[deps]
BayesBase = "b4ee3484-f114-42fe-b91c-797d54a0c67e"
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
Cairo = "159f3aea-2a34-519c-b102-8c37f9878175"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
ExponentialFamily = "62312e5e-252a-4322-ace9-a5f4bf9b357b"
ExponentialFamilyProjection = "17f509fa-9a96-44ba-99b2-1c5f01f0931b"
GraphPPL = "b3f8163a-e979-4e85-b43e-1f63d8c8b42c"
GraphPlot = "a2cc645c-3eea-5389-862e-a155d0052231"
Optimisers = "3bd65402-5787-11e9-1adc-39752487f4e2"
Expand All @@ -12,6 +14,7 @@ ReactiveMP = "a194aa59-28ba-4574-a09c-4a745416d6e3"
Rocket = "df971d30-c9d6-4b37-b8ff-e965b2cb3a40"
RxInfer = "86711068-29c9-4ff7-b620-ae75d7495b3d"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd"

[compat]
Documenter = "1.0.0"
9 changes: 7 additions & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ foreach(vcat(ExamplesOverviewPath, ExamplesCategoriesOverviewPaths)) do path
@warn "`$(path)` does not exist. Generating an empty overview. Use the `make examples` command to generate the overview and all examples."
mkpath(dirname(path))
open(path, "w") do f
write(f, "The overview is missing. Use the `make examples` command to generate the overview and all examples.")
write(f, """
$(isequal(path, ExamplesOverviewPath) ? "# [Examples overview](@id examples-overview)" : "")
The overview is missing. Use the `make examples` command to generate the overview and all examples.
""")
end
end
end
Expand Down Expand Up @@ -108,7 +111,9 @@ makedocs(;
"Streamline inference" => "manuals/inference/streamlined.md",
"Initialization" => "manuals/inference/initialization.md",
"Auto-updates" => "manuals/inference/autoupdates.md",
"Deterministic nodes" => "manuals/inference/delta-node.md"
"Deterministic nodes" => "manuals/inference/delta-node.md",
"Non-conjugate inference" => "manuals/inference/nonconjugate.md",
"Undefined message update rules" => "manuals/inference/undefinedrules.md"
],
"Inference customization" => [
"Defining a custom node and rules" => "manuals/customization/custom-node.md",
Expand Down
8 changes: 4 additions & 4 deletions docs/src/manuals/comparison.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ Nowadays there's plenty of probabilistic programming languages and packages avai
using RxInfer #hide
@model function inner_inner(τ, y, x)
y ~ Normal(τ[1], τ[2] + x)
y ~ Normal(mean = τ[1], var = τ[2] + x)
end
@model function inner(θ, α)
β ~ Normal(0, 1)
α ~ Gamma(β, 1)
β ~ Normal(mean = 0.0, var = 1.0)
α ~ Gamma(shape = β, rate = 1.0)
α ~ inner_inner(τ = θ, x = 3)
end
@model function outer()
local w
for i = 1:5
w[i] ~ inner(θ = Gamma(1, 1))
w[i] ~ inner(θ = Gamma(shape = 1.0, rate = 1.0))
end
y ~ inner(θ = w[2:3])
end
Expand Down
30 changes: 26 additions & 4 deletions docs/src/manuals/constraints-specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,19 +177,19 @@ Read more about the `@constraints` macro in the [official documentation](https:/

```@example manual_constraints
@model function inner_inner(τ, y)
y ~ Normal(τ[1], τ[2])
y ~ Normal(mean = τ[1], var = τ[2])
end
@model function inner(θ, α)
β ~ Normal(0, 1)
α ~ Gamma(β, 1)
β ~ Normal(mean = 0.0, var = 1.0)
α ~ Gamma(shape = β, rate = 1.0)
α ~ inner_inner(τ = θ)
end
@model function outer()
local w
for i = 1:5
w[i] ~ inner(θ = Gamma(1, 1))
w[i] ~ inner(θ = Gamma(shape = 1.0, rate = 1.0))
end
y ~ inner(θ = w[2:3])
end
Expand Down Expand Up @@ -250,6 +250,28 @@ end
```
More information can be found in the [GraphPPL documentation](https://reactivebayes.github.io/GraphPPL.jl/stable/plugins/constraint_specification/#Default-constraints).

## Constraints on the data

By default, `RxInfer` assumes that, since the data comes into the model as observed, the posterior marginal distribution of the data is independent from other marginals and is a Dirac-delta distribution. However, this assumption breaks when we pass missing data into our model. When the data is missing, we might have a joint dependency between the data and latent variables, as the missing data essentially behaves as a latent variable. In such cases, we can wrap the data in a `UnfactorizedData`. This will notify the inference engine that the data should not be factorized out and we can specify a custom factorization constraint on these variables using the `@constraints` macro.

```@docs
UnfactorizedData
```

```@example constraints-specification
unfactorized_example_constraints = @constraints begin
q(y[1:1000], μ, τ) = q(y[1:1000])q(μ)q(τ)
q(y[1001:1100], μ, τ) = q(y[1001:1100], μ)q(τ)
end
result = infer(
model = iid_normal(),
data = (y = UnfactorizedData(vcat(rand(NormalMeanPrecision(3.1415, 2.7182), 1000), [missing for _ in 1:100])),),
constraints = unfactorized_example_constraints,
initialization = init,
iterations = 25
)
```

## Prespecified constraints
`GraphPPL` exports some [prespecified constraints](https://reactivebayes.github.io/GraphPPL.jl/stable/plugins/constraint_specification/#Prespecified-constraints) that can be used in the `@constraints` macro, but these constraints can also be passed as top-level constraints in the `infer` function. For example, to specify a mean-field assumption on all variables in the model, we can use the `MeanField` constraint:

Expand Down
2 changes: 2 additions & 0 deletions docs/src/manuals/customization/custom-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Welcome to the `RxInfer` documentation on creating custom factor graph nodes. In `RxInfer`, factor nodes represent functional relationships between variables, also known as factors. Together, these factors define your probabilistic model. Quite often these factors represent distributions, denoting how a certain parameter affects another. However, other factors are also possible, such as ones specifying linear or non-linear relationships. `RxInfer` already supports a lot of factor nodes, however, depending on the problem that you are trying to solve, you may need to create a custom node that better fits the specific requirements of your model. This tutorial will guide you through the process of defining a custom node in `RxInfer`, step by step. By the end of this tutorial, you will be able to create your own custom node and integrate it into your model.

In addition, read another section on a different way of running inference with custom stochastic nodes without explicit rule specification [here](@ref inference-undefinedrules).

---

To create a custom node in `RxInfer`, 4 steps are required:
Expand Down
2 changes: 1 addition & 1 deletion docs/src/manuals/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,4 @@ result.posteriors[:θ]

## Where to go next?

There are a set of [examples](@ref examples-overview) available in `RxInfer` repository that demonstrate the more advanced features of the package for various problems. Alternatively, you can head to the [Model specification](@ref user-guide-model-specification) which provides more detailed information of how to use `RxInfer` to specify probabilistic models. [Inference execution](@ref user-guide-inference-execution) section provides a documentation about `RxInfer` API for running reactive Bayesian inference. Also read the [Comparison](@ref comparison) to compare `RxInfer` with other probabilistic programming libraries.
There are a set of [examples](@ref examples-overview) available in `RxInfer` repository that demonstrate the more advanced features of the package for various problems. Alternatively, you can head to the [Model specification](@ref user-guide-model-specification) which provides more detailed information of how to use `RxInfer` to specify probabilistic models. [Inference execution](@ref user-guide-inference-execution) section provides a documentation about `RxInfer` API for running reactive Bayesian inference. Also read the [Comparison](@ref comparison) to compare `RxInfer` with other probabilistic programming libraries. For advances use cases refer to the [Non-conjugate inference](@ref inference-nonconjugate) tutorial and inference [without defining the message update rules explicitly](@ref inference-undefinedrules).
Loading

0 comments on commit f737ac1

Please sign in to comment.