Learning with Tree-Averaged Densities and Distributions