Geometry, moments and Bayesian networks with hidden variables