You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
41
41
42
42
### References
43
43
44
44
-[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)).
45
46
-[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.
46
47
-[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.
47
48
-[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:
56
57
57
58
Optionally, use `] test RxInfer` to validate the installation by running the test suite.
58
59
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
+
59
67
# Getting Started
60
68
61
69
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/).
Now let's see how to specify this model using GraphPPL's package syntax.
115
-
116
123
```julia
117
-
118
124
# GraphPPL.jl export `@model` macro for model specification
119
125
# It accepts a regular Julia function and builds an FFG under the hood
120
-
@modelfunctioncoin_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
+
@modelfunctioncoin_model(y, a, b)
127
127
# We endow θ parameter of our model with some prior
128
-
θ ~Beta(2.0, 7.0)
129
-
128
+
θ ~Beta(a, b)
130
129
# We assume that outcome of each coin flip
131
130
# is governed by the Bernoulli distribution
132
-
for i in1:n
131
+
for i ineachindex(y)
133
132
y[i] ~Bernoulli(θ)
134
-
end
135
-
133
+
end
136
134
end
135
+
```
137
136
137
+
Alternatively, we could use a broadcasting syntax.
138
+
```julia
139
+
@modelfunctioncoin_model(y, a, b)
140
+
θ ~Beta(a, b)
141
+
y .~Bernoulli(θ)
142
+
end
138
143
```
139
144
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.
141
149
142
150
### Inference specification
143
151
144
152
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.
0 commit comments