Bayesian networks for interpretable machine learning and optimization