Variable Elimination is an exact inference algorithm for Bayesian networks and Markov random fields.
Implement Variable Elimination. Read Bayesian and Markov networks and evidence file specified using .uai format (http://graphmod.ics.uci.edu/uai08/FileFormat). Variable elimination algorithm has three steps:
-
Instantiate Evidence (Reduce the CPTs or factors)
-
Order the variables
-
Eliminate variables one by one along the order. To eliminate a variable, we compute a product of all functions that mention the variable and sum-out the variable from the result. Then we replace all functions that mention the variable with this new function
-
Navigate into the VariableElimination folder
-
Launch command prmpt
-
Run VE_exe.exe on command promt using following command
$ java -jar VE_exe.jar
$ java -jar VE_exe.jar BN_4.uai BN_4.uai.evid
---------------------------RESULT------------------------------
Maximum width: 19
Log Base e probability of evidence = -3.991165429944898
Log Base 10 probability of evidence = -1.7330288449608764
Probability of evidence = 0.01847816655753799
Total execution time = 17 seconds!
Output file: output1611.txt written successfully!
NOTE:
-
OutputXXXX.txt file is created with the above output in the same folder
-
BN_6.uai and BN_8.uai produces Out Of Memory Error: Java heap space because min order generated produces higher treewidth.