EDML: A Method for Learning Parameters in Bayesian Networks