Applications and Computation of Stateful Polya Trees