1. An information processing apparatus comprising: a memory configured to store a computer program; and a processor configured to execute the computer program stored in the memory to function as: an encoding unit configured to encode an input pattern to a code including a plurality of bits based on differences between feature amounts on the input pattern; a calculation unit configured to calculate reliabilities for respective bits of the code based on differences between the feature amounts against the input pattern; 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.