Update a binary-event probability after observations
A point estimate alone hides the difference between two observations and two thousand. Return posterior variance with the updated mean. One success and one failure update a uniform prior to Beta(2,2). The posterior mean is 0.5 and its variance is 0.05.
Run the framework with your own input
Install Blyx 0.2.1 and a Rust toolchain with a host linker, then run the versioned project. Each positional argument is a number or a comma-separated numerical vector. The CLI accepts up to 16 entries per vector. The imported module accepts longer inputs.
git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-redstart.git
cd blyx-redstart
blyxc native-run project.blyx -- 1 1 1 1API and return values
Returns [posterior mean, posterior variance, posterior alpha, posterior beta]. This conjugate model assumes exchangeable Bernoulli observations. Invalid input returns an empty vector.
| Argument | Accepted input |
|---|---|
| alpha | positive finite number |
| beta | positive finite number |
| positive | nonnegative exact integer |
| negative | nonnegative exact integer |
Use the libraries independently
The framework vendors the same library source published in these two repositories. Each module has its own package page, input contract and regression suite.
Try the program
Expected output
0.5 0.05 2 2
Practice
Change positive = 0.0, negative = 0.0. Predict the result, then run the program.
Hint
Returns [posterior mean, posterior variance, posterior alpha, posterior beta]. This conjugate model assumes exchangeable Bernoulli observations.
Worked solution
The result vector is [0.5, 0.08333333333333333, 1, 1]. Compare its fields with the return layout in the API section.
Find
let positive = 1.0;Replace with
let positive = 0.0;Find
let negative = 1.0;Replace with
let negative = 0.0;Output after the change
0.5 0.08333333333333333 1 1
