A generalized learning paradigm exploiting the structure of feedforward neural networks