Skip to content

Commit c9072c3

Browse files
authored
Merge pull request #272 from ReactiveBayes/dev-3.0.0
New big release 3.0.0
2 parents 2a3a8cf + c193af8 commit c9072c3

File tree

140 files changed

+52576
-49233
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+52576
-49233
lines changed

Project.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "RxInfer"
22
uuid = "86711068-29c9-4ff7-b620-ae75d7495b3d"
33
authors = ["Bagaev Dmitry <d.v.bagaev@tue.nl> and contributors"]
4-
version = "2.17.1"
4+
version = "3.0.0"
55

66
[deps]
77
BayesBase = "b4ee3484-f114-42fe-b91c-797d54a0c67e"
@@ -28,15 +28,15 @@ Distributions = "0.25"
2828
DomainSets = "0.5.2, 0.6, 0.7"
2929
ExponentialFamily = "1.2"
3030
FastCholesky = "1.3.0"
31-
GraphPPL = "3.1.0"
31+
GraphPPL = "~4.0.0"
3232
LinearAlgebra = "1.9"
3333
MacroTools = "0.5.6"
3434
Optim = "1.0.0"
3535
ProgressMeter = "1.0.0"
3636
Random = "1.9"
37-
ReactiveMP = "~3.14.0"
37+
ReactiveMP = "~4.0.0"
3838
Reexport = "1.2.0"
39-
Rocket = "1.7.0"
39+
Rocket = "1.8.0"
4040
TupleTools = "1.2.0"
4141
julia = "1.9"
4242

README.md

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@ Inference with RxInfer | Inference with HMC
3636
![](benchmarks/plots/inference_rxinfer.svg?raw=true&sanitize=true) | ![](benchmarks/plots/inference_turing.svg?raw=true&sanitize=true)
3737

3838
The benchmark and accuracy experiment, which generated these plots, is available in the `benchmarks/` folder. Note, that the execution speed and accuracy
39-
of the HMC estimator heavily depends on the choice of hyper-parameters.
40-
In this example, RxInfer executes exact inference consistently and does not depend on any hyper-parameters.
39+
of the HMC estimator heavily depends on the choice of hyperparameters.
40+
In this example, RxInfer executes exact inference consistently and does not depend on any hyperparameters.
4141

4242
### References
4343

4444
- [RxInfer: A Julia package for reactive real-time Bayesian inference](https://doi.org/10.21105/joss.05161) - a reference paper for the `RxInfer.jl` framwork.
45+
- [Reactive Probabilistic Programming for Scalable Bayesian Inference](https://pure.tue.nl/ws/portalfiles/portal/313860204/20231219_Bagaev_hf.pdf) - a PhD dissertation outlining core ideas and principles behind `RxInfer` ([link2](https://research.tue.nl/nl/publications/reactive-probabilistic-programming-for-scalable-bayesian-inferenc), [link3](https://github.com/bvdmitri/phdthesis)).
4546
- [Variational Message Passing and Local Constraint Manipulation in Factor Graphs](https://doi.org/10.3390/e23070807) - describes theoretical aspects of the underlying Bayesian inference method.
4647
- [Reactive Message Passing for Scalable Bayesian Inference](https://doi.org/10.48550/arXiv.2112.13251) - describes implementation aspects of the Bayesian inference engine and performs benchmarks and accuracy comparison on various models.
4748
- [A Julia package for reactive variational Bayesian inference](https://doi.org/10.1016/j.simpa.2022.100299) - a reference paper for the `ReactiveMP.jl` package, the underlying inference engine.
@@ -56,6 +57,13 @@ Install RxInfer through the Julia package manager:
5657

5758
Optionally, use `] test RxInfer` to validate the installation by running the test suite.
5859

60+
# Documentation
61+
62+
For more information about `RxInfer.jl` please refer to the [documentation](https://reactivebayes.github.io/RxInfer.jl/stable/).
63+
64+
> [!NOTE]
65+
> `RxInfer.jl` API has been changed in version `3.0.0`. See [Migration Guide](https://reactivebayes.github.io/RxInfer.jl/stable/manuals/migration-guide-v2-v3) for more details.
66+
5967
# Getting Started
6068

6169
There are examples available to get you started in the `examples/` folder. Alternatively, preview the same examples in the [documentation](https://reactivebayes.github.io/RxInfer.jl/stable/examples/overview/).
@@ -79,7 +87,7 @@ n = 500 # Number of coin flips
7987
p = 0.75 # Bias of a coin
8088

8189
distribution = Bernoulli(p)
82-
dataset = float.(rand(Bernoulli(p), n))
90+
dataset = float.(rand(distribution, n))
8391
```
8492

8593
### Model specification
@@ -112,40 +120,40 @@ P(y_{1:N}, \theta) = P(\theta) \prod_{i=1}^N P(y_i | \theta).
112120
```
113121

114122
Now let's see how to specify this model using GraphPPL's package syntax.
115-
116123
```julia
117-
118124
# GraphPPL.jl export `@model` macro for model specification
119125
# It accepts a regular Julia function and builds an FFG under the hood
120-
@model function coin_model(n)
121-
122-
# `datavar` creates data 'inputs' in our model
123-
# We will pass data later on to these inputs
124-
# In this example we create a sequence of inputs that accepts Float64
125-
y = datavar(Float64, n)
126-
126+
@model function coin_model(y, a, b)
127127
# We endow θ parameter of our model with some prior
128-
θ ~ Beta(2.0, 7.0)
129-
128+
θ ~ Beta(a, b)
130129
# We assume that outcome of each coin flip
131130
# is governed by the Bernoulli distribution
132-
for i in 1:n
131+
for i in eachindex(y)
133132
y[i] ~ Bernoulli(θ)
134-
end
135-
133+
end
136134
end
135+
```
137136

137+
Alternatively, we could use a broadcasting syntax.
138+
```julia
139+
@model function coin_model(y, a, b)
140+
θ ~ Beta(a, b)
141+
y .~ Bernoulli(θ)
142+
end
138143
```
139144

140-
As you can see, `RxInfer` offers a model specification syntax that resembles closely to the mathematical equations defined above. We use `datavar` function to create "clamped" variables that take specific values at a later date. $\theta \sim \mathrm{Beta}(2.0, 7.0)$ expression creates random variable $θ$ and assigns it as an output of $\mathrm{Beta}$ node in the corresponding FFG.
145+
As you can see, `RxInfer` offers a model specification syntax that resembles closely to the mathematical equations defined above. The $\theta \sim \mathrm{Beta}(2.0, 7.0)$ expression creates random variable $θ$ and assigns it as an output of $\mathrm{Beta}$ node in the corresponding FFG.
146+
147+
> [!NOTE]
148+
> `RxInfer.jl` uses `GraphPPL.jl` for model and constraints specification. `GraphPPL.jl` API has been changed in version `4.0.0`. See [Migration Guide](https://reactivebayes.github.io/GraphPPL.jl/stable/) for more details.
141149
142150
### Inference specification
143151

144152
Once we have defined our model, the next step is to use `RxInfer` API to infer quantities of interests. To do this we can use a generic `infer` function from `RxInfer.jl` that supports static datasets.
145153

146154
```julia
147155
result = infer(
148-
model = coin_model(length(dataset)),
156+
model = coin_model(a = 2.0, b = 7.0),
149157
data = (y = dataset, )
150158
)
151159
```

benchmarks/Linear Multivariate Gaussian State Space Model Benchmark.ipynb

Lines changed: 1076 additions & 2055 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)