Building a Bayesian factor tree from examples