A mean field theory learning algorithm for neural networks