A neural network model for pattern recognition