A Bayesian approach to learning mixtures of nonparametric components