Structured Neural Networks for Pattern Recognition