Dynamic inference-based learning of Markov network structure