An Introduction to the Theory and Applications of Bayesian Networks