a bottom-up approach to probabilistic graphical models