Machine Learning with Dirichlet and Beta Process Priors: Theory and Applications