Repository contains the derivation of Belief Propagation algorithm from the ground up, as well as generic Java implementation of the Belief Propagation algorithm.
PDF with detailed derivation of the algorithm for Pairwise Markov Random Fields (at the moment this is still in a draft version, and any comments are welcome): https://github.com/lagodiuk/java-belief-propagation/blob/master/derivation_of_belief_propagation_algorithm/Derivation.pdf
Examples of the inference over the different Pairwise Markov Random Fields can be found in folder: src/test/java/com/lahodiuk/bp/example/
Compile the library:
$ mvn clean install
Run an example:
$ java -cp "target/bp-1.0-SNAPSHOT.jar:target/lib/*" com.lahodiuk.bp.example.ImageReconstruction
For more details check the class: https://github.com/lagodiuk/java-belief-propagation/blob/master/src/main/java/com/lahodiuk/bp/example/ImageReconstruction.java