How AI-based machines are taught to work?