Pattern recognition in AI