Theoretical Foundations of Machine Learning and Deep Learning