A cognitive hierarchy model of learning in networks