Pattern recognition as a noisy channel