Bayesian Network Training Algorithm