Neural network pattern recognition