A Cognitive Framework for Imitation Learning