1. An information processing apparatus comprising: an encoding unit configured to encode an input pattern to a code including a plurality of bits; a calculation unit configured to calculate reliabilities for respective bits of the code; a generation unit configured to generate similar codes each similar to the code based on the reliabilities; and a recognition unit configured to recognize the input pattern based on the code encoded by said encoding unit and the similar codes generated by said generation unit.