Variational Inference for Sparse and Undirected Models