Machine Learning: A Bayesian and Optimization Perspective