Learning by searching; recognizing by finding