Learning Bayesian Networks with Thousands of Variables