A global approach for learning sparse Ising models